Skip to content

Instantly share code, notes, and snippets.

@nheinrich
nheinrich / gist:1171939
Created August 25, 2011 21:03
Using Sass & Compass in Rails 3.1

app/assets/stylesheets/application.css

/*
  *= require "application/all"
*/

app/assets/stylesheets/application/_all.sass

@tcr
tcr / async.coffee
Created July 18, 2011 21:13
Serial/Parallel functions in CoffeeScript
# Asynchronous DSL for CoffeeScript
serial = (f) ->
next = -> arr.shift().apply(null, arguments) if arr.length
arr = (v for k, v of f(next))
next()
null
parallel = (f, after = ->) ->
res = {}; arrc = 0
@pepijndevos
pepijndevos / parsistent_heap.clj
Created January 15, 2011 17:13
A persistent heap implemented in Clojure
(ns persistent-heap)
(defn swap [heap idx idy]
(assoc heap idx (get heap idy) idy (get heap idx)))
(defn children [idx]
(let [idx (inc (* idx 2))
idy (inc idx)]
[idx idy]))