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 sqlalchemy import exists, text, exc, select, and_, literal, cast | |
from sqlalchemy.ext.compiler import compiles | |
from sqlalchemy.sql.expression import Executable, ClauseElement | |
class InsertFromSelect(Executable, ClauseElement): | |
""" Insert from select""" | |
def __init__(self, table, select, *fields, **kw): | |
self.table = table | |
self.select = select |
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
define (require, exports) -> | |
$ = require 'jquery' | |
exports.queued = (func) -> | |
q = $({}) | |
wrapper = -> | |
args = arguments | |
q.queue (next) => | |
func.apply(this, args).then(next, next) |
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
COFFEE = $(shell find coffee -name '*.coffee' -type f) | |
JS = $(COFFEE:coffee/%.coffee=js/%.js) | |
SASS = $(shell find sass -name '*.sass' -type f) | |
all: js css | |
watch: | |
watch -n1 $(MAKE) |
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
class exports.Behaviour extends View | |
setElement: -> | |
this.$el.removeClass(this.className) if this.className? | |
super | |
remove: -> | |
this.$el.removeClass(this.className) if this.className? | |
this.undelegateEvents() | |
this.stopListening() |
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
// js | |
var handlers = require('handlers'); | |
var impls = handlers.impls; | |
var impl = handlers.impl; | |
var ret = handlers.ret; | |
// coffee | |
{impls, impl, ret} = require 'handlers' | |
WTF?! |
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
lazyproperty = (obj, name, func, enumerable) -> | |
Object.defineProperty obj, name, | |
configurable: true | |
enumerable: not not enumerable | |
get: -> | |
value = func.call(this) | |
Object.defineProperty(this, name, | |
{value, enumerable: !!enumerable, writable: true}) | |
value | |
set: (value) -> |
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 ruby | |
# Convert SASS/SCSS to Stylus | |
require 'sass' | |
class ToStylus < Sass::Tree::Visitors::Base | |
def visit(node) | |
method = "visit_#{node_name node}" | |
if self.respond_to?(method, 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
require 'json' | |
require 'uri_template' | |
require 'scorched' | |
class Controller < Scorched::Controller | |
include Scorched::Options('uri_templates') | |
## | |
# Generate URI out of the template |
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 coffee | |
fs = require 'fs' | |
{Parser, tree} = require 'less' | |
{extend} = require 'underscore' | |
filename = process.argv[2] | |
parser = new Parser(filename: filename) | |
str = fs.readFileSync(filename).toString() |
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 coffee | |
fs = require 'fs' | |
crypto = require 'crypto' | |
{Parser, tree} = require 'less' | |
{extend, isString} = require 'underscore' | |
filename = process.argv[2] | |
parser = new Parser(filename: filename) | |
str = fs.readFileSync(filename).toString() |