Skip to content

Instantly share code, notes, and snippets.

View FireyFly's full-sized avatar

FireFly FireyFly

View GitHub Profile
-- for testing
function server(url)
return function (tbl)
print(url)
for k,v in pairs(tbl) do
print(k,v)
end
end
end
@FireyFly
FireyFly / gtb.js
Created February 13, 2014 23:02
GTB compiler thing
// Use \ to escape []%
var map = { "\\[": "[",
"\\]": "]",
"\\%": "%",
"[": ":Lbl 0:",
"]": ":Goto 0:",
"@": ":If ",
"#": ":Else",
"$": ":Then:",
{-
f . g x . h $ y f . g x . h y
($) (.)
/ \ / \
/ \ / \
(.) y f (.)
/ \ .´ `.
/ \ .´ `.
f (.) (appl) (appl)
NB. I7 bits
1
1111
1 101 1
0 101 001
----
@FireyFly
FireyFly / thisless.js
Last active December 17, 2015 00:38
Get rid of `this` thing
"use strict"
// Attempt to shoehorn Lua's (or Python's) "first parameter is `this`" model
// into JS's object model. Makes us not have to worry about `this` at all.
Function.prototype.applyW = function (args) {
return this.apply(null, args)
}
function wrap(fn) {
@FireyFly
FireyFly / fun.js
Created April 23, 2013 18:53
JS obfustring stuff
console.log((
$=([]+!+[]),_=([]+[][(![]+[])[+[]]+([][[]]+[])[!![]+!+[]+!+[]+!+[]+!+[]]+(![]+[]
)[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!![]]]),$_=([]+[][(![]+[])[+[]]+([][[]]
+[])[!![]+!+[]+!+[]+!+[]+!+[]]+(![]+[])[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!
![]]])[!![]+!+[]+!+[]]+_[!![]+!+[]+!+[]+!+[]+!+[]+!+[]]+_[!![]+!+[]]+(![]+[])[!!
[]+!+[]+!+[]]+$[+[]]+$[+!![]]+$[!![]+!+[]]+([]+[][(![]+[])[+[]]+([][[]]+[])[!![]
+!+[]+!+[]+!+[]+!+[]]+(![]+[])[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!![]]])[!!
[]+!+[]+!+[]]+$[+[]]+([]+[][(![]+[])[+[]]+([][[]]+[])[!![]+!+[]+!+[]+!+[]+!+[]]+
(![]+[])[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!![]]])[!![]+!+[]+!+[]+!+[]+!+[]
+!+[]]+$[+!![]],_=$_[$_][$_]("$",$[+!![]]+$[!![]+!+[]+!+[]]+$[+[]]+$[!![]+!+[]]+
@FireyFly
FireyFly / rps.js
Last active December 16, 2015 11:19 — forked from yorickvP/rps.js
function RPS(count) {
this.players = count
this.score = range(count).map(Const(0))
this.moves = range(count).map(limit(Array,0))
}
RPS.prototype.beats = { "rock": "scissors",
"paper": "rock",
"scissors": "paper" }
@FireyFly
FireyFly / code.catena.sh
Last active December 16, 2015 03:39
Catena scratchpad
#### Library definitions ########################
#### drop
drop2 := drop drop;
drop3 := drop drop2;
drop4 := drop drop3;
drop5 := drop drop4;
#### nip
nip := dip [drop];
@FireyFly
FireyFly / gist:5365694
Created April 11, 2013 18:02
Brainfuck implementation in `sed`
#!/bin/sed -rf
# Sedfuck - brainfuck interpreter in sed.
# Written by Jonas Höglund (FireFly, firefly.nu).
h
s/^(.|[^.])*$/0/
# Setup some memory.
s/0/0000000000/g
#s/0/0000000000/g
@FireyFly
FireyFly / gist:4993523
Last active December 13, 2015 23:39
Om language playground
define {
-- { drop }
foldl {
--{ x0 xs f → v, fold list with function }
dequote
choose{
rearrange{B}{_ B _}
}{