Skip to content

Instantly share code, notes, and snippets.

View wilkes's full-sized avatar

Wilkes Joiner wilkes

View GitHub Profile
(ns karras.test-hooks
(:require [karras.core :as karras])
(:use karras.entity
karras.sugar
[karras.collection :only [drop-collection collection]]
clojure.test
midje.semi-sweet
robert.hooke))
(defn get-type [entity-or-type]
(defn zip-with [fs & arg-seqs]
(apply map (fn [f & args] (apply f args)) fs arg-seqs))
;; => (zip-with [+ -] [1 2] [3 4]) => '(4 -2)
(defn zip-with [fs & arg-seqs]
(apply map (fn [f & args] (apply f args)) fs arg-seqs))
;; => (zip-with [+ -] [1 2] [3 4]) => '(4 -2)
(defn sort-by-keys [keys maps]
(sort (fn [x y]
(first (remove #(= 0 %)
(map #(compare (% x) (% y)) keys))))
maps))
;; in the repl
(use 'kibitz.growl)
(def a (growl-watch-project "path-to-your-project"))
;; keep the agent around since kibitz is a bit buggy now
def copy_to_temp(file_upload):
tmp = tempfile.NamedTemporaryFile(delete=False)
while True:
data = file_upload.read(8192)
tmp.write(data)
if not data:
break
tmp.flush()
return tmp
(ns pfad.ch1)
(set! *warn-on-reflection* true)
;; Compute the smallest natural number not in a given finite set of X
;; natural numbers.
;; Array based solution
;; minfree = search . checklist
@wilkes
wilkes / config-js2.el
Created January 12, 2011 15:52
js2-mode indentation
;; http://mihai.bazon.net/projects/editing-javascript-with-emacs-js2-mode
(defun my-js2-indent-function ()
(interactive)
(save-restriction
(widen)
(let* ((inhibit-point-motion-hooks t)
(parse-status (save-excursion (syntax-ppss (point-at-bol))))
(offset (- (current-column) (current-indentation)))
(indentation (espresso--proper-indentation parse-status))
node)
@wilkes
wilkes / higher_order.clj
Created January 28, 2011 20:52
testing higher order functions with midje 1.0.1
(ns higer-order
(:use midje.sweet))
(defn sum-with [f vs]
(apply + (map f vs)))
(defn double [x]
(* x 2))
(defn sum-double [xs]
# Make it use C-a, similar to screen..
unbind C-b
unbind l
set -g prefix C-o
bind-key C-o last-window
# Reload key
bind r source-file ~/.tmux.conf
set -g default-terminal "screen-256color"