This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; puts all jars in ~/lib/jars on the classpath for slime interaction | |
;; should come after (clojure-slime-config) has been evaluated | |
(dolist (jarfile (directory-files "~/lib/jars" t "\\.jar$")) | |
(add-to-list 'swank-clojure-classpath jarfile)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSL redirect middleware | |
# | |
# Use as follows in url configs: | |
# | |
# (r'^registration/', include('myapp.registration.urls'), {'SSL':True}), | |
from django.conf import settings | |
from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect, get_host | |
SSL = 'SSL' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; surrounding in * suggests the var is meant to be rebound using binding or used as a | |
;; global variable or constant | |
(def *earmuffs*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; i have a vector [1 2 3] | |
;; i want to produce a hash map as follows: | |
;; {1 <1 + 1> 2 <2 + 1> 3 <3 + 1>} | |
;; {1 2, 2 3, 3 4} | |
(reduce (fn [m x] (assoc m x (+ x 1))) {} [1 2 3]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; must be AOT compiled as far as I can tell | |
(ns com.example.ExampleJob | |
(:use [clojure.contrib.duck-streams :only [spit]]) | |
(:gen-class | |
:implements [org.quartz.Job])) | |
(defn -execute | |
[this context] | |
(spit "qrtz.txt" "HI")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" java.lang.ClassCastException: java.io.StringWriter (NO_SOURCE_FILE:0) | |
at clojure.lang.Compiler.eval(Compiler.java:4658) | |
at clojure.core$eval__5254.invoke(core.clj:2031) | |
at clojure.main$eval_opt__7429.invoke(main.clj:225) | |
at clojure.main$initialize__7436.invoke(main.clj:244) | |
at clojure.main$null_opt__7464.invoke(main.clj:269) | |
at clojure.main$main__7484.doInvoke(main.clj:338) | |
at clojure.lang.RestFn.invoke(RestFn.java:426) | |
at clojure.lang.Var.invoke(Var.java:363) | |
at clojure.lang.AFn.applyToHelper(AFn.java:175) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" name="email" value="Enter your email address" onclick="this.value=''" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn blah1 [& params] (apply hash-map params)) | |
(defn blah2 [& params] (blah1 params)) | |
;; user> (blah1) | |
;; {} | |
;; user> (blah2) | |
;; No value supplied for key: null | |
;; [Thrown class java.lang.IllegalArgumentException] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; pass in a vector, get a querystring | |
(defn build-querystring [params] | |
(let [qpairs (map #(str-join "=" (str %)) params)] | |
(apply str (interpose "&" qpairs)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo su - | |
# | |
# Audio: fix ubuntu 9.04 broken sound | |
# | |
apt-get install build-essential xmlto libncurses5-dev | |
export ALSA="1.0.20" |