new Intl.NumberFormat([locales[, options]])
Intl.NumberFormat.call(this[, locales[, options]])
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This assumes the runner supports | |
// - generators (for a transpiler see http://facebook.github.io/regenerator/) | |
// - Promises (for a polyfill see https://github.com/petkaantonov/bluebird) | |
// | |
// This does not need outside libraries to be loaded | |
// | |
// This survives direct eval semantics, unless you use regenerator, in which case the unwinding will cause variable renaming | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Two parts: Viewer and Publisher | |
Viewer | |
GET /posts of type Essay (https://tent.io/types/post/essay/v0.1.0) | |
Is notified when a new Essay is POSTed | |
Displays them as a blog | |
Publisher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro >> [& [first-expr & rest-exprs]] | |
(if (empty? rest-exprs) | |
first-expr | |
`(let [~'it ~first-expr] | |
(thread-it ~@rest-exprs)))) | |
(>> | |
[jay john mike chris] | |
(filter (comp (partial = "new york") :current-city) it) | |
(group-by :employer it) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = 5 | |
points_total = 0 | |
points_inside = 0 | |
loop do | |
points_total += 1 | |
x, y = rand * r * 2 - r, rand * r * 2 - r | |
points_inside += 1 if (x ** 2 + y ** 2) < (r ** 2) | |
puts "#{points_inside}/#{points_total}: pi == #{4 * points_inside / points_total.to_f}" if points_total % 10000 == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var points_total = 0; | |
var points_inside = 0; | |
var x, y, i; | |
while(true) { | |
for(i = 0; i < 10000; i++) { | |
x = Math.random(); | |
y = Math.random(); | |
points_inside += 2 + ~(x*x + y*y); | |
} | |
points_total += i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defprotocol IOffset | |
(-offset [x])) | |
(extend-type js/Element | |
IOffset | |
(-offset [x] | |
[(.-offsetLeft x) (.-offsetTop x)])) | |
(defprotocol IScroll | |
(-scroll [x])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python or Ruby | |
l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10)),'l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10))','print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q)))' | |
print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
var first = function (arr, c) { | |
c(arr[0]); | |
}; | |
var rest = function (arr, c) { | |
c(arr.slice(1)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stack, $draws = [], {} | |
def method_missing *args | |
return if args[0][/^to_/] | |
$stack << args.map { |a| a or $stack.pop } | |
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
end | |
class Array | |
def +@ |
OlderNewer