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,2 @@
EncodingUtil.urlDecode('http%3A%2F%2Ffoo%20bar%2F', 'UTF-8');
EncodingUtil.urlDecode('google.com/search?q=%60Abdu%27l-Bah%C3%A1', 'UTF-8');

View file

@ -0,0 +1 @@
bytes('http%3A%2F%2Ffoo%20bar%2F') -> decodeurl

View file

@ -0,0 +1,2 @@
put urlDecode("http%3A%2F%2Ffoo%20bar%2F") & cr & \
urlDecode("google.com/search?q=%60Abdu%27l-Bah%C3%A1")

View file

@ -0,0 +1,2 @@
http://foo bar/
google.com/search?q=`Abdu'l-Bah√°

View file

@ -0,0 +1,3 @@
import cgi
echo decodeUrl("http%3A%2F%2Ffoo%20bar%2F")

View file

@ -0,0 +1,7 @@
func urldecode(str) {
str.gsub!('+', ' ');
str.gsub!(/\%([A-Fa-f0-9]{2})/, {|a| 'C'.pack(a.hex)});
return str;
}
say urldecode('http%3A%2F%2Ffoo+bar%2F'); # => "http://foo bar/"

View file

@ -0,0 +1,6 @@
import Foundation
let encoded = "http%3A%2F%2Ffoo%20bar%2F"
if let normal = encoded.stringByReplacingPercentEscapesUsingEncoding(NSUTF8StringEncoding) {
println(normal)
}

View file

@ -0,0 +1,27 @@
# Emit . and stop as soon as "condition" is true.
def until(condition; next):
def u: if condition then . else (next|u) end;
u;
def url_decode:
# The helper function converts the input string written in the given
# "base" to an integer
def to_i(base):
explode
| reverse
| map(if 65 <= . and . <= 90 then . + 32 else . end) # downcase
| map(if . > 96 then . - 87 else . - 48 end) # "a" ~ 97 => 10 ~ 87
| reduce .[] as $c
# base: [power, ans]
([1,0]; (.[0] * base) as $b | [$b, .[1] + (.[0] * $c)]) | .[1];
. as $in
| length as $length
| [0, ""] # i, answer
| until ( .[0] >= $length;
.[0] as $i
| if $in[$i:$i+1] == "%"
then [ $i + 3, .[1] + ([$in[$i+1:$i+3] | to_i(16)] | implode) ]
else [ $i + 1, .[1] + $in[$i:$i+1] ]
end)
| .[1]; # answer

View file

@ -0,0 +1 @@
"http%3A%2F%2Ffoo%20bar%2F" | url_decode

View file

@ -0,0 +1 @@
"http://foo bar/"