Codd is a new SQL query building library that is the spiritual successor to Gesundheit. In Gesundheit, a "query" was a mutable object with methods that modified a (nominally) internal AST for a SQL statement. While this enabled an API that was both familiar and expressive, it had some unfortunate side-effects (pun intended). For example, making a non-destructive modification to an existing query requires a deep copy of it's AST.
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 mysql = require('mysql'); | |
var Gearman = require('gearman-node') | |
var once = require('once'); | |
var pool = mysql.createPool({ | |
host : 'localhost', | |
user : 'ingress', | |
password : 'ingress12345', | |
database : 'ingress_data', | |
connectionLimit : 5, |
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
chdir(/usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/Resources/vim) | |
fchdir() to previous dir | |
sourcing "$VIM/vimrc" | |
finished sourcing $VIM/vimrc | |
chdir(/Users/stephen) | |
fchdir() to previous dir | |
sourcing "$HOME/.vimrc" | |
Searching for "ftoff.vim" in "/Users/stephen/.vim,/usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/Resources/vim/vimfiles,/usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/Resources/vim/runtime,/usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/Resources/vim/vimfiles/after,/Users/stephen/.vim/after" | |
Searching for "/Users/stephen/.vim/ftoff.vim" |
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
DROP DATABASE IF EXISTS stupid_simple_test; | |
CREATE DATABASE stupid_simple_test; | |
USE stupid_simple_test; | |
CREATE TABLE users ( | |
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
email VARCHAR(255) NOT NULL, | |
password VARCHAR(255) -- Should be properly encrypted in a real application! |
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
macro $do { | |
case ($($x = $y) (,) ...) $body => { | |
(function ($x (,) ...) $body)($y (,) ...) | |
} | |
case $name ($($x = $y) (,) ...) $body => { | |
(function $name ($x (,) ...) $body)($y (,) ...) | |
} | |
} | |
macro $var { |
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
/** | |
* A quick proof-of-concept of observable objects using JS accessors | |
* | |
* Base observable objects are created with * `new Observable(names)`, where | |
* `names` is an array of property names that should be observable. | |
* | |
* Instances are created by calling .create(initial_data) on the resulting | |
* base object, and observed with their .observe(handler) method. See the bottom | |
* of this file for an example. | |
*/ |
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
inspect = require('util').inspect | |
module.exports = function (config_path, opts) { | |
var settings = { | |
toJSON: function() { return this.__proto__ }, | |
inspect: function() { return inspect(this.__proto__) }, | |
} | |
opts || (opts = {}) | |
if (!opts.error) { |
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
// block-lambda proponents: what does this program do? | |
function in_canadian (speak_cb) { | |
add_eh = {|y| | |
return y + ", eh?" | |
} | |
// now here comes a bunch of code. | |
// imagine there are 50 lines here |
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
vows = require 'vows' | |
assert = require 'assert' | |
{mock, expect, lastCall, verify, pred, isDeep, any, verifyNoMore} = require './mtfw' | |
suite = vows.describe('mtfw core').addBatch "A mock will": | |
topic: -> mock() | |
"be an object": (m) -> assert.isObject m | |
"create new mocks when properties are accessed": -> | |
m1 = mock() |
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
makeTemplate = (path) -> | |
i = 0 | |
path.replace(/\*(\w)?/g, "{+raw#{i++}}$1") | |
.replace(/:(\w+)/g, '{$1}') | |
.replace(/List}/g, 's*}') | |
uriTemplateMiddleware = (path='/') -> | |
spec = null | |
(req, res, next) -> | |
if req.path == path |