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 FILE = require("file"); | |
require.paths.unshift(FILE.join(FILE.dirname(module.path), | |
"jsmacros/vendor/jison/lib")); | |
var Parser = require("jison").Parser; | |
require.paths.shift(); | |
var grammar = { | |
lex: { | |
rules: [ |
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 FILE = require("file"); | |
require.paths.unshift(FILE.join(FILE.dirname(module.path), | |
"jsmacros/vendor/jison/lib")); | |
var Parser = require("jison").Parser; | |
require.paths.shift(); | |
var grammar = { | |
lex: { | |
rules: [ |
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
//@use bind.jsm | |
function returnsMultipleVals () { | |
return ["foo", "bar"]; | |
} | |
var foo, bar; | |
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
from N!#@R ... <sipps.7@gmail.com> | |
to fitzgen@gmail.com | |
date Tue, Oct 26, 2010 at 11:20 PM | |
subject Need help with Javascript issue | |
mailed-by gmail.com | |
signed-by gmail.com | |
Hello, | |
I just visited your blog http://fitzgeraldnick.com/weblog/ for some of the javascript related code snippets and it was really cool! I just thought if you could help me with something that I am trying.. |
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
from django import http | |
import operator | |
import pickle | |
def copy_pickleable(a, b): | |
for k, v in a.iteritems(): | |
try: | |
pickle.dumps(v) | |
b[k] = v | |
except TypeError: |
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
import pickle | |
# Simple generator that counts up to maximum, but you can set the counter by | |
# sending in new values. | |
def counter(maximum): | |
i = 0 | |
while i < maximum: | |
val = (yield i) | |
# If value provided, change counter | |
if val is not None: |
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
acc = (n)-> | |
(i)-> | |
n += i | |
======================= | |
var acc; | |
acc = function(n) { | |
return function(i) { | |
return n += 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
function toArray(obj, i) { | |
return Array.prototype.slice.call(obj, i || 0); | |
} | |
function tco(fn) { | |
return function () { | |
var args = toArray(arguments), | |
shouldContinue = true, | |
recur = function () { | |
shouldContinue = true; |
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 () { | |
// conceal the Thunk class to avoid | |
// so that the only way to make one is | |
// to call Function::thunk | |
function Thunk(fn, args) { | |
this.fn = fn; | |
this.args = args; | |
} | |
Thunk.prototype.force = function () { |
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
# Output of the example which is console.logged at the bottom of operations.js: | |
$ node operations.js | |
To change 'kitten' in to 'sitting': | |
[ [ 'delete', 'k' ] | |
, [ 'insert', 's' ] | |
, [ 'retain', 1 ] | |
, [ 'retain', 1 ] | |
, [ 'retain', 1 ] | |
, [ 'delete', 'e' ] |