Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,4 @@
;; asynchronous call back definition
(define (success name text) (writeln 'Loaded name) (writeln text))
;;
(file->string success "https:/sourceforge.net")

View file

@ -0,0 +1,3 @@
local(x = curl('https://sourceforge.net'))
local(y = #x->result)
#y->asString

View file

@ -0,0 +1,10 @@
ch = xtra("Curl").new()
CURLOPT_URL = 10002
ch.setOption(CURLOPT_URL, "https://sourceforge.net")
res = ch.exec(1)
if integerP(res) then
put "Error:" && curl_error(res)
else
put "Result:" && res.readRawString(res.length)
end if
-- "Result: <!doctype html> ..."

View file

@ -0,0 +1,2 @@
sx = xtra("Shell").new()
put sx.shell_cmd("curl https://sourceforge.net")

View file

@ -0,0 +1,2 @@
libURLSetSSLVerification true --check cert
get URL "https://sourceforge.net/"

View file

@ -0,0 +1,10 @@
on myUrlDownloadFinished
get URL "https://sourceforge.net/" -- this will now fetch a locally cached copy
put it
end myUrlDownloadFinished
command getWebResource
libURLFollowHttpRedirects true
libURLSetSSLVerification true --check cert
load URL "https://sourceforge.net/" with message "myUrlDownloadFinished"
end getWebResource

3
Task/HTTPS/Nim/https.nim Normal file
View file

@ -0,0 +1,3 @@
import httpclient
echo getContent "https://sourceforge.net"

View file

@ -0,0 +1,2 @@
cStr= download("http://sourceforge.net/")
see cStr + nl

View file

@ -0,0 +1,11 @@
var lwp = require('LWP::UserAgent'); # LWP::Protocol::https is needed
var url = 'https://rosettacode.org';
var ua = lwp.new(
agent => 'Mozilla/5.0',
ssl_opts => Hash.new(verify_hostname => 1),
);
var resp = ua.get(url);
resp.is_success || die "Failed to GET #{url.dump}: #{resp.status_line}";
print resp.decoded_content;

View file

@ -0,0 +1,15 @@
import Foundation
// With https
let request = NSURLRequest(URL: NSURL(string: "https://sourceforge.net")!)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue()) {res, data, err in // callback
// data is binary
if (data != nil) {
let string = NSString(data: data!, encoding: NSUTF8StringEncoding)
println(string)
}
}
CFRunLoopRun() // dispatch