Skip to content

Instantly share code, notes, and snippets.

View andreypopp's full-sized avatar
🏠
Working from home

Andrey Popp andreypopp

🏠
Working from home
View GitHub Profile
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
define (require, exports) ->
$ = require 'jquery'
exports.queued = (func) ->
q = $({})
wrapper = ->
args = arguments
q.queue (next) =>
func.apply(this, args).then(next, next)
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)
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()
// js
var handlers = require('handlers');
var impls = handlers.impls;
var impl = handlers.impl;
var ret = handlers.ret;
// coffee
{impls, impl, ret} = require 'handlers'
WTF?!
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) ->
#!/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)
require 'json'
require 'uri_template'
require 'scorched'
class Controller < Scorched::Controller
include Scorched::Options('uri_templates')
##
# Generate URI out of the template
#!/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()
#!/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()