Skip to content

Instantly share code, notes, and snippets.

View otfrom's full-sized avatar
I may be slow to respond.

Bruce Durling otfrom

I may be slow to respond.
View GitHub Profile
@otfrom
otfrom / date_parsing.clj
Created September 6, 2014 11:49
nil punning date parsing
;; as opposed to https://github.com/clj-time/clj-time/blob/master/src/clj_time/format.clj#L149-L158
(defn parse-exception-flow-control
"Returns a DateTime instance in the UTC time zone obtained by parsing the
given string according to the given formatter."
([^String s]
(first
(for [f (vals formatters)
:let [d (try (parse f s) (catch Exception _ nil))]
:when d] d))))
(maybe-install-and-require 'gist)
@otfrom
otfrom / init.el
Last active December 26, 2015 02:49
A minimally broken ~/.emacs.d/init.el for cider.
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
;; This means we prefer things from ~/.emacs.d/elpa over the standard packages.
(package-initialize)
;; This bootstraps us if we don't have anything
(when (not package-archive-contents)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"property" "annual_emissions" "normalised_cost" "monthly_cost" "Gas" "Electrical"
"foo" 9.48120598985868 3.32516229028219 23.4645618950913 0 9.48120598985868
"bar" 13.9329659660887 4.7563711817271 32.8744521510371 1.06302263189102 12.8699433341977
"baz" 14.8021361709446 5.19127050544977 30.8015383323353 0 14.8021361709446
@otfrom
otfrom / gist:3980588
Created October 30, 2012 14:40
lein deps :tree for a pallet project
[ch.qos.logback/logback-classic "1.0.0" :exclusions [[org.cloudhoist/pallet] [org.jclouds/jclouds-allblobstore] [org.jclouds/jclouds-allcompute] [org.jclouds/jclouds-compute] [org.jclouds/jclouds-blobstore] [org.jclouds.driver/jclouds-slf4j] [org.jclouds.driver/jclouds-jsch] [org.jclouds.labs/greenqloud-compute]]]
[ch.qos.logback/logback-core "1.0.0" :exclusions [[org.cloudhoist/pallet] [org.jclouds/jclouds-allblobstore] [org.jclouds/jclouds-allcompute] [org.jclouds/jclouds-compute] [org.jclouds/jclouds-blobstore] [org.jclouds.driver/jclouds-slf4j] [org.jclouds.driver/jclouds-jsch] [org.jclouds.labs/greenqloud-compute]]]
[org.clojure/clojure "1.4.0" :exclusions [[org.cloudhoist/pallet] [org.jclouds/jclouds-allblobstore] [org.jclouds/jclouds-allcompute] [org.jclouds/jclouds-compute] [org.jclouds/jclouds-blobstore] [org.jclouds.driver/jclouds-slf4j] [org.jclouds.driver/jclouds-jsch] [org.jclouds.labs/greenqloud-compute]]]
[org.clojure/data.xml "0.0.6" :exclusions [[org.cloudhoist/pallet] [org.jclouds/jclouds
@otfrom
otfrom / demo.clj
Created January 31, 2012 23:22
Team 1 Battleship Code
(ns battleships.demo)
;; This is an example of how to create a player to submit to the server.
;; The entire namespace is submitted to the server.
;; You submit the file using the submit function in the client namespace.
(defn- random-coord
"Generates a random valid coordinate."
[]
(let [rows ["A" "B" "C" "D" "E" "F" "G" "H" "I" "J"]