View spin.py
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
#!/usr/bin/env python | |
import sys | |
import time | |
def uchar(code): | |
return ('\\U%08x' % code).decode('unicode-escape') | |
start = 0x1F550 | |
end = 0x1F55B | |
emoji = map(uchar, range(start, end + 1)) |
View spin.rb
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
#!/usr/bin/env ruby | |
def spin | |
("\u{1F550}" .. "\u{1F55B}").cycle.each do |moji| | |
print moji, " " | |
sleep 0.1 | |
print "\r" | |
end | |
end |
View decorators.rb
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
module MyDecorators | |
def limit(max, name) | |
tries = 0 | |
m = instance_method(name) | |
define_method(name) do |*args| | |
tries += 1 | |
if tries <= max | |
m.bind(self).call(*args) | |
else | |
raise "LIMITER ENGAGED" |
View backtracking.js
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
const P = require('parsimmon'); | |
const Chalk = require('chalk'); | |
function wants(x) { | |
process.stdout.write(Chalk.bold.red('( wants ' + Chalk.cyan(x) + ' ) ')); | |
return x; | |
} | |
function got(x) { | |
console.log(Chalk.bold.green('( GOT ' + Chalk.cyan(x) + ' )')); |
View fish_prompt.fish
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 fish_prompt | |
set E | |
set E $E \U1F51C # soon | |
set E $E \U1F354 # hamburger | |
set E $E \U1F4A9 # poo | |
set E $E \U1F47A # tengu | |
set E $E \U1F349 # watermelon | |
set E $E \U1F300 # cyclone | |
set E $E \U1F37A # beer | |
set E $E \U1F382 # cake |
View math.js
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 util = require("util"); | |
var P = require("parsimmon"); | |
// Throw away whitespace surrounding a string. | |
function operator(s) { | |
return P.optWhitespace | |
.then(P.string(s)) | |
.skip(P.optWhitespace); | |
} |
View functional-oop-mixins.js
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 fly(creature) { | |
return ( | |
"The " + creature.species + | |
" flies using its " + creature.methodOfFlight | |
); | |
} | |
function hunt(creature, otherCreature) { | |
return ( | |
"The " + creature.species + |
View bad.js
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
export default [ | |
"module1", | |
"module2" | |
].map(x => System.import(x)).then(([ | |
module1, | |
module2 | |
])) => { | |
return { | |
myApi: whatever | |
}; |
View ew.coffee
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
setTimeout () -> | |
console.log("Hello!") | |
, 300 |
View ruby-ish.sqg.rb
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
### Imports | |
let {JSON, document, console} = global | |
### Basic data | |
let namedConstants = [true, false, null, undefined] | |
let numbers = [1, 2, 1_000, 3.14, NaN, -Infinity] | |
let strings = ["hello,\n", "\u{20}", "\"world\"\u{2757}"] | |
let arrays = [[], [1, 2], [3, [[4]], [5]]] |