Skip to content

Instantly share code, notes, and snippets.

(let [name "test"]
(cond
(= "test" name)
(do-this)
(= "that" name)
(do-that)
:else
(do-other)))
(ns interface.boot
"This namespace is only used while developing
to start and stop an internal webserver."
(:use [ring.adapter.jetty :only [run-jetty]]
[ring.middleware.stacktrace :only [wrap-stacktrace]])
(:require [interface.routes :as routes])
(:gen-class))
(def ^:dynamic *port* 8081)
@devn
devn / hack.sh
Created March 31, 2012 17:54 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@devn
devn / ci.sh
Created March 28, 2012 16:20 — forked from rsanheim/ci.sh
Simple continuous deployment via Jenkins and Capistrano for all branches. Wire this up with Github post receive hooks from Jenkins for best results.
#!/bin/bash -x
# This should be your "script/ci" checked into version control, and then wired as your sole build step in Jenkins.
#
# Simplifying Assumptions:
#
# * You build all branches
# * You want to deploy all branches.
# * You wired up an SSH key to your CI server appropriately so it can talk to your deployment target(s) via Cap
@devn
devn / at_all.clj
Created March 12, 2012 22:24 — forked from ctford/at_all.clj
A short piano piece in Overtone
(ns overtunes.songs.at-all
(:use
[overtone.live :only [at now]]
[overtone.inst.sampled-piano :only [sampled-piano]]))
(defn bpm [beats-per-minute]
(let [start (now)
ms-per-minute (* 60 1000)
ms-per-beat (/ ms-per-minute beats-per-minute)]
#(+ start (* ms-per-beat %))))
@devn
devn / gist:2019102
Created March 12, 2012 01:08 — forked from rsanheim/gist:1871433
ec2_display.sh
#!/bin/bash
export DISPLAY=":$(ps -ef|grep '.*nxagent.*-[D].*' | cut -d':' -f5).0"
xhost +SI:localuser:pair
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@devn
devn / index.txt
Created February 27, 2012 04:40 — forked from gus/index.txt
Ruby/Clojure analogs
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@devn
devn / foo.rb
Created February 10, 2012 21:49 — forked from manveru/foo.rb
class Hash
def true_of?(key, &block)
TrueOf.new(self, key).instance_eval(&block)
end
end
class TrueOf
attr_reader :key, :value
def initialize(hash, key, &block)
@devn
devn / lithp.rb
Created January 26, 2012 04:07 — forked from fogus/lithp.rb
class Lisp
def initialize
@env = {
:label => lambda { |(name,val), _| @env[name] = val },
:quote => lambda { |sexpr, _| sexpr[0] },
:car => lambda { |(list), _| list[0] },
:cdr => lambda { |(list), _| list.drop 1 },
:cons => lambda { |(e,cell), _| [e] + cell },
:eq => lambda { |(l,r), _| l == r },
:if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) },