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 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] |
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
(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) |
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
(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) |
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
(defn sort-by-keys [keys maps] | |
(sort (fn [x y] | |
(first (remove #(= 0 %) | |
(map #(compare (% x) (% y)) keys)))) | |
maps)) | |
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
;; 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 |
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
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 |
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 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 |
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
;; 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) |
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 higer-order | |
(:use midje.sweet)) | |
(defn sum-with [f vs] | |
(apply + (map f vs))) | |
(defn double [x] | |
(* x 2)) | |
(defn sum-double [xs] |
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
# 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" |