Skip to content

Instantly share code, notes, and snippets.

View gist:11581
# POST data for an individual listing
View gist:2039406
function addTodo()
var a = document.getElementById('list').getElementsByTagName('li')[0].firstChild.nodeValue;
var x=document.getElementById("nameOfItem").value;
alert("Please eneter a ToDo item.");
else if(x.length > 200)
View gist:2905038
export CLASSPATH="/Users/daniel/jars/clojure-1.4.0/clojure-1.4.0.jar:$CLASSPATH"
alias "cljrepl"="java clojure.main"
View gist:2929345
;; env PATH
(when (equal system-type 'darwin)
(setenv "PATH" (concat "/opt/local/bin:/usr/local/bin:" (getenv "PATH")))
(push "/opt/local/bin" exec-path)
(push "/usr/local/bin" exec-path))
;; text
(set-face-attribute 'default nil :height 140)
(load-theme 'deeper-blue)
View arenas.clj
(ns routey.views.arenas
(:require [routey.views.common :as common]
[noir.content.pages :as pages])
(:use noir.core
flyingmachine / gist:3390402
Created Aug 18, 2012
Installing Ruby after upgrading from Snow Leopard to Mountain Lion
View gist:3390402

After you've done the steps below it will be as if you did an upgrade rather than a clean install. Your home directory will be there, as will your applications.

  1. Back up system to an external HD (I used Super Duper)
  2. Install mountain lion clean:
  3. At the end of the install, transfer files back from my external HD
  4. Remove everything in /usr/local with sudo rm -Rf /usr/local/*
  5. Follow these instructions:
  6. I had trouble with ree/1.8.7 so I had to follow these instructions:
flyingmachine / gist:4004807
Created Nov 2, 2012
clojure korma heroku db connection
View gist:4004807
(defdb db
(if (System/getenv "DATABASE_URL")
(let [db-uri ( (System/getenv "DATABASE_URL"))
user-and-password (clojure.string/split (.getUserInfo db-uri) #":")]
{:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:user (get user-and-password 0)
:password (get user-and-password 1) ; may be nil
:subname (if (= -1 (.getPort db-uri))
(format "//%s%s" (.getHost db-uri) (.getPath db-uri))
View gist:4089112
(if (or (equal system-name "DH.local")
(equal system-name "DH.mba2"))
(setq initial-frame-alist '((top . 0) (left . 0)
(width . 177) (height . 47)))
(setq initial-frame-alist '((top . 0) (left . 0)
(width . 187) (height . 77))))
View robot.js
function Robot(robot) {}
// well, we need to do something...
// whenever our robot is idle, this method gets called.
Robot.prototype.onIdle = function(ev) {
var robot;
robot = ev.robot;
var r = robot.position.x % 2
flyingmachine / example-usage-after.clj
Created Dec 16, 2012
so far, only used in a web app when I want to update a subset of available fields. eg when changing a password
View example-usage-after.clj
(defentity user
(has-many post)
(has-many comment)
;; todo move user param transform function here
(fn [attributes]
(-> (transform-when-key-exists
{:password #(creds/hash-bcrypt %)