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 code = '(1 2 (3 4 "h\"i"))' | |
function parse_lisp(code) { | |
var tokens = code.match(/\(|\)|\d+|"[^"]*"/g) | |
var tree = [] | |
function parse_array() { |
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 code = '["do", ["set", "x", 0], ["while", ["<", ["get", "x"], 10], ["set", "x", ["+", ["get", "x"], 1]]]]' | |
function parse_lisp(x) { | |
return JSON.parse(x) | |
} | |
console.log('hi') | |
var lisp_variables = {} |
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
pragma solidity ^0.4.0; | |
contract TicTacToe { | |
struct Game { | |
address[2] players; | |
uint256 prize_pool; | |
uint256[9] board; | |
} | |
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
_.fiberize = function (x) { | |
if (typeof(x) == 'object') { | |
for (var k in x) | |
if (typeof(x[k]) == 'function') | |
x[k] = _.fiberize(x[k]) | |
return x | |
} else if (typeof(x) == 'function') { | |
return function () { | |
var args = _.toArray(arguments) | |
args.push(_.p()) |
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
// example: | |
// var ret = highlightDiff("hello earth", "hello mars") | |
// console.log(ret) | |
// { | |
// "a": "hello <span style=\"background-color:yellow\">earth</span>", | |
// "b": "hello <span style=\"background-color:yellow\">mars</span>" | |
// } | |
function highlightDiff(a, b) { | |
a = a.match(/\w+|\S+|\s+/g) |
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
_.csv = function (data, headers) { | |
if (headers === undefined) headers = true | |
if (typeof(data) == 'object') { | |
var s = [] | |
function escapeCsv(s) { | |
if (s.match(/[,"\n]/)) | |
return '"' + s.replace(/"/g, '""') + '"' | |
return s | |
} | |
function escapeLine(a) { |