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
def bar(): | |
return 'bar!' | |
def foo(v): | |
return 'foo! ' + v | |
def meow(): | |
yield foo((yield bar())) | |
a = meow() |
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
/** | |
* Functional promise | |
*/ | |
var Promise = (function createPromise(listeners, resolved) { | |
var self = this; | |
if (typeof listeners === 'undefined') { | |
listeners = []; | |
} |
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
/** | |
* Functional promise | |
*/ | |
var Promise = (function createPromise(listeners, resolved) { | |
var self = this; | |
if (typeof listeners === 'undefined') { | |
listeners = []; | |
} |
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 fs = require('fs'); | |
var start_fs = (new Date()).getTime(); | |
var data = fs.readFileSync('./100_log', 'utf-8'); | |
var start = (new Date()).getTime(); | |
var log = data.split('\n').map(function (line) { | |
var match = line.match(/\[([^\]]+)\] \[([^\]]+)\] \[([^ ]+) ([^\]]+)\] (.*)/); |
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 sh | |
find /home/ryan/* -maxdepth 0 -exec echo '{}' + | |
find /repos/* -maxdepth 0 -exec echo '{}' + | |
echo /etc/nginx/conf/nginx.conf | |
echo /etc/named/ |
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
/*jslint browser: true, nomen: true */ | |
/*global jQuery, console */ | |
(function ($) { | |
'use strict'; | |
var timer, timer_delay = 250, next_id = 0, selectors = {}; | |
/** | |
* Keep checking the DOM for new selectors | |
*/ |
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
/*jslint node: true, nomen: true, sloppy: true, newcap: true */ | |
var vows = require('vows'), | |
utils = require('./util'); | |
vows.describe('array stuffs').addBatch(util.parallelize({ | |
'when I have an array': { | |
topic: function () { | |
return [1, 2, 3]; | |
}, |
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 seems slow | |
SELECT listing_id FROM tags WHERE name = 'game_hon' | |
INTERSECT | |
SELECT listing_id FROM tags WHERE name = 'west' | |
INTERSECT | |
SELECT listing_id FROM tags WHERE name = 'ap' | |
INTERSECT | |
( | |
-- Is there a more efficient way to store this? |
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
/*jshint undef: false */ | |
var hello = 123, | |
world = 3421; | |
foo = 321, | |
bar = 421; | |
// passes! |
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
/** | |
* Returns a promise that with method `cancel` which stops the callbacks | |
* from propagating. | |
* | |
* This is useful if you attach a promise callback to change UI elements, | |
* but then the user decides they don't want to wait for the data to load, | |
* and instead loads another object in that promise's place. | |
* | |
* @param {$.Promise} promise Promise to add ability to cancel | |
* @return {$.Promise} promise Promise with `cancel({Boolean} allowSuccess, {Boolean} allowError)` method |