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 reduce-sql-vec | |
"Takes an array of SQL statement vectors and combines | |
them into a valid clojure.java.jdbc query vector. In each statement vector | |
you can have parameters at the end just like a jdbc vector. Easier to show | |
than explain: | |
take this: | |
[[\"SELECT * FROM dude\"] | |
[\" WHERE id = ?\" 1]] |
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
; List functions of a namespace | |
; https://stackoverflow.com/questions/2747294/how-to-list-the-functions-of-a-namespace | |
(keys (ns-publics 'foo)) |
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
# build_init.py | |
# python startup script for interpreting a build.py file | |
# | |
# Install: | |
# download, place this file where you like, | |
# & then add the path to PYTHONSTARTUP env variable. | |
# ex: | |
# export PYTHONSTARTUP=$HOME/.config/python/build_init.py | |
# | |
# build.py: |
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
# water polygons | |
# | |
wget http://data.openstreetmapdata.com/water-polygons-split-3857.zip | |
unzip water-polygons-split-3857.zip | |
shp2pgsql -dID -s 900913 -W Windows-1252 -g the_geom water-polygons-split-3857/water_polygons.shp water_polygons | psql "$@" | |
rm ./water-polygons-split-3857.zip && rm -rf ./water-polygons-split-3857 | |
# land polygons | |
# | |
wget http://data.openstreetmapdata.com/land-polygons-split-3857.zip |
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 slurp-edn [f] | |
(with-open [r (PushbackReader. (io/reader f))] | |
(let [edn-seq (repeatedly (partial edn/read {:eof :EOF} r))] | |
(doall (take-while #(not= :EOF %) edn-seq))))) | |
(defn in? | |
"true if seq contains elm" | |
[seq elm] | |
(some #(= elm %) seq)) |
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
(ns overtone.examples.internal-sequencer | |
(:use [overtone.live])) | |
;; A fully server-side sample sequencer. | |
;; ===================================== | |
;; This example demonstrates some of the benefits of moving all synth | |
;; triggers inside the server itself. For example, it allows you to | |
;; modify the synthesis with *immediate* effect (rather than waiting for | |
;; the next bar/chunk to be scheduled) and you can use a global pulse to |
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
(def db (atom nil)) | |
(defn error [e] | |
(.error js/console "An IndexedDB error has occured!" e)) | |
(defn new [cb] | |
(let [version 1 | |
request (.open js/indexedDB "lokate" version)] | |
(set! (.-onupgradeneeded request) (fn [e] | |
(reset! db (.. e -target -result)) |