Skip to content

Instantly share code, notes, and snippets.

// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
# my new favorite bashrc function
# quickly inspect source files in style
function pless {
pygmentize $1 | less -r
}
# my new favorite bashrc function
# quickly inspect source files in style
function pless {
pygmentize $1 | less -r
}
(ns com.freiheit.clojure.appengine.appengine-local
(:use
[compojure.http routes servlet helpers]
clojure.contrib.test-is
compojure.server.jetty
[clojure.contrib def str-utils duck-streams])
(:require
[clojure.contrib.logging :as log])
(:import
[com.google.appengine.api.labs.taskqueue.dev LocalTaskQueue]
(ns com.freiheit.clojure.appengine.appengine-local
(:use
[compojure.http routes servlet helpers]
clojure.contrib.test-is
compojure.server.jetty
[clojure.contrib def str-utils duck-streams])
(:require
[clojure.contrib.logging :as log])
(:import
[com.google.appengine.api.labs.taskqueue.dev LocalTaskQueue]
_lein_test()
{
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
if [ -d test ]; then
COMPREPLY=($(compgen -W '$(cd test; find * -name \*.clj | sed "s/.clj\$//" | sed "s/_/-/g" | sed "s|/|.|g")' -- $curw));
return 0
fi
}
_lein_test()
{
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
if [ -d test ]; then
COMPREPLY=($(compgen -W '$(cd test; find * -name \*.clj | sed "s/.clj\$//" | sed "s/_/-/g" | sed "s|/|.|g")' -- $curw));
return 0
fi
}
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@stantont
stantont / clj
Created November 19, 2009 03:54
#!/bin/bash
#Clojure command-line startup file cobbled together from different--forgotten--sources
BREAK_CHARS="(){}[],^%$#@\"\";:''|\\"
JAR_DIR=/Users/stantont/lib/java/jars
CLOJURE_JAR=$JAR_DIR/clojure.jar
CONTRIB_JAR=$JAR_DIR/clojure-contrib.jar
COMPLETIONS=""
if [ -e $HOME/.clj/completions ]; then
COMPLETIONS="-f $HOME/.clj/completions"
--modified version of http://www.macosxhints.com/article.php?story=20041024142036862
--skips non-hard drives, ie, DVD/CD drives
tell application "Finder"
set bootDisk to the name of startup disk
set allVolumes to the name of every disk whose (name is not bootDisk) and (local volume is true) and ((format is Mac OS Extended format) or (format is Mac OS format))
repeat with myDisk in allVolumes
try
eject myDisk
end try
end repeat