This file contains hidden or 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 thought map was lazy and that first only took the first thing but ... | |
(first (map (fn [x] (print "XXXX" x "XXXX") x) [1 2 3 4])) ;; XXXX 1 XXXXXXXX 2 XXXXXXXX 3 XXXXXXXX 4 XXXX1 | |
;; Unless it is a list | |
(first (map (fn [x] (print "XXXX" x "XXXX") x) '(1 2 3 4)));; XXXX 1 XXXX1 | |
;; deffing it gives no output | |
(def foo (map (fn [x] (print "XXXX" x "XXXX") x) [1 2 3 4])) | |
;; but this does |
This file contains hidden or 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
(ns stats.redis-resource | |
(:import | |
(org.joda.time DateTime)) | |
(:require | |
[clj-time.coerce] | |
[clj-redis.client :as redis])) | |
;; This is not particularly groundbreaking (I am sure abstractions exist around redis I just didnt find them when I looked). | |
;; More interested in whether using reify was the best approach |
This file contains hidden or 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
(ns clojuredojo.core) | |
(defn palindrome-detector [thing] (= (reverse thing) (seq thing)) ) | |
(def __ palindrome-detector) | |
(false? (__ '(1 2 3 4 5))) | |
(true? (__ "racecar")) | |
(true? (__ [:foo :bar :foo])) | |
(true? (__ '(1 1 3 3 1 1))) |
This file contains hidden or 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
(use 'overtone.live) | |
(defcgen triangle-osc [freq phase {:default 0.0} harmonics {:default 40}] | |
(:ar (let | |
[ | |
harmonic-numbers (take harmonics (iterate (partial + 2) 1)) | |
cosines (set (map #(- (* 4 %) 1) (range 1 harmonics)))] | |
(klang [ | |
(map #(* freq %) harmonic-numbers) ;; harmonics | |
(map #(/ 1.0 (* % %)) harmonic-numbers) ;; inverse square ampl | |
(map #(+ phase %) (map #(if (cosines %) (. Math PI) 0.0) harmonic-numbers))])))) ;; conditional phase shift by pi |
This file contains hidden or 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
# if you already have postgres installed | |
mkdir /tmp/postg | |
sudo mv /usr/include/pg* /tmp/postg | |
gem uninstall pg | |
bundle install | |
#Installing postgres on the LION! | |
brew update | |
brew install postgresql |
This file contains hidden or 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
/* jslint | |
adsafe: false, | |
bitwise: true, | |
browser: true, | |
cap: false, | |
continue: false, | |
css: true, | |
debug: false, | |
devel: true, | |
eqeq: false, |
This file contains hidden or 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
[ { | |
"method" : "POST", | |
"to" : "/node", | |
"body" : { | |
"name" : "Jen" | |
}, | |
"id" : 1111 | |
}, { | |
"method" : "POST", | |
"to" : "/index/node/people", |
This file contains hidden or 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
(ns git-charts.core | |
(:use [incanter.core] [incanter.zoo]) | |
(:require (incanter stats charts io))) | |
(defn read-dataset [] | |
(incanter.io/read-dataset "/Users/jen/Dropbox/legacy codebase/ove-gitstats/lines_of_code.dat" :delim \space)) | |
(defn clean-dataset [ds] | |
(incanter.core/col-names ds [:Date :Locs])) |
This file contains hidden or 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
1169071810 0 | |
1169138071 6294 | |
1169143071 23245 | |
1169143580 23245 | |
1169144084 23275 | |
1169145926 23275 | |
1169149435 31231 | |
1169150235 34922 | |
1169153198 47651 | |
1169153433 30684 |
This file contains hidden or 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
1) Download cloc, chmod it and have it on your path somewhere (as cloc) | |
2) get the scan-history script | |
curl https://raw.github.com/rhunter/git-scan-history/master/bin/git-scan-history > ~/bin/git-scan-history | |
3) chmod it | |
chmod +x ~/bin/git-scan-history |