Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mudphone on github.
  • I am mudphone (https://keybase.io/mudphone) on keybase.
  • I have a public key whose fingerprint is FF35 CE0E FF69 7142 4D78 3392 BF8D EE48 35D2 BA0F

To claim this, I am signing this object:

@mudphone
mudphone / gist:7592124
Last active December 29, 2015 01:19
From the Clojure Data Analysis Cookbook... an useful display of the lazy-seq macro.
(defn lazy-read-csv
[csv-file]
(let [in-file (io/reader csv-file)
csv-seq (csv/read-csv in-file)
lazy (fn lazy [wrapped]
(lazy-seq
(if-let [s (seq wrapped)]
(cons (first s) (lazy (rest s)))
(.close in-file))))]
(lazy csv-seq)))
@mudphone
mudphone / clj-minecraft_scratch.clj
Last active December 23, 2015 16:59
Rename constant to use hyphens.
(ns cljminecraft.scratch
(:require [cljminecraft.core :as core]
[cljminecraft.bukkit :as bk]
[cljminecraft.blocks :as blocks]
[cljminecraft.events :as ev]
[cljminecraft.entity :as ent]
[cljminecraft.player :as plr]
[cljminecraft.util :as util]
[cljminecraft.logging :as log]
[cljminecraft.config :as cfg]
@mudphone
mudphone / EmacsCheatsheet.md
Last active December 16, 2015 11:49
An Emacs Cheatsheet (for me, not you)

Get Help

  • C-h f function-name function by name
  • C-h k key-sequence function name for key
  • C-h w function-name where bound by name

Move around:

  • C-x arrow-key

NREPL Clojure

More here on the nrepl page.

@mudphone
mudphone / data_hawaii_gov_listing.txt
Last active December 14, 2015 17:38
http://data.hawaii.gov dataset listing as of 2013/3/8.
# FROM: https://data.hawaii.gov/browse/embed?limitTo=datasets&page=n
# WHERE: n = 1 to 36
#
# Raw datasets can be retrieved via the "ID," using this URL style:
# http://data.hawaii.gov/resource/INSERT_ID_HERE.json
# WHERE: INSERT_ID_HERE is the 4x4 ID in the list below.
#
0) Name: /Banking-Finance-and-Insurance/Export-Import-FY-2006-Applications ID: jki6-u4jp
1) Name: /Banking-Finance-and-Insurance/Export-Import-FY-2006-Participants ID: yhdt-apb3
2) Name: /Banking-Finance-and-Insurance/Export-Import-FY-2007-Applications ID: b522-5988
@mudphone
mudphone / processing2withEmacs
Last active December 14, 2015 08:49
Processing 2 with Emacs
install Processing (Mac) version 2.0b9
install processing-emacs
$ cd ~/.emacs.d/vendor
$ git clone https://github.com/ptrv/processing2-emacs.git
install processing-java command line utility
- Open Processing.app
- Tools > Install "processing-java"
@mudphone
mudphone / clojure_dev_lein_nrepl.md
Last active December 12, 2015 02:19
Clojure dev with Lein 2 and nrepl (Swank-less)

Before heading down this path, consider using Emacs Live, which is a nice set of defaults for working with Clojure, Overtone and Quil.

Also, check out this nice write-up on debugging with nREPL.

I also drew inspiration (copied things) from Ryan Neufeld's config, which you should also consider using.

Finally, you can check out my ~/.emacs.d/init.el config on GitHub.

All this as of May, 2013...

@mudphone
mudphone / .gitconfig
Created January 24, 2013 23:06
A simple .gitconfig file.
[user]
name = <# YOUR NAME #>
email = <# YOUR EMAIL #>
[alias]
co = checkout
st = status
ci = commit
br = branch
sm = submodule
smu = submodule update
@mudphone
mudphone / emacs_clojure_nrepl_setup_20121015.txt
Last active October 11, 2015 17:08
Clojure dev with Lein 2 and nrepl (Swank-less)
= install lein 2
- Do this: https://github.com/technomancy/leiningen
- download lein script, it will boot strap itself
- install on path, rename to lein, chmod 755
- run lein --version
Leiningen 2.0.0 on Java 1.6.0_37 Java HotSpot(TM) 64-Bit Server VM
= Emacs >= 24
- Download latest version: http://emacsformacosx.com, if you want the GUI version
- Or, for CLI, use homebrew
@mudphone
mudphone / Another-Clojure-Y-Combinator.clj
Created August 1, 2012 09:29
Another Clojure Y-Combinator
;; Y-Combinator in Clojure
;; based on: http://mvanier.livejournal.com/2897.html
;; This is the simple naive implementation.
(defn simple-factorial
"A simple, naive implementation of the factorial function."
[n]
(if (= n 0)
1
(* n (simple-factorial (dec n)))))