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
;; Inspired by George Jahad's version: http://georgejahad.com/clojure/debug-repl.html | |
(defmacro local-bindings | |
"Produces a map of the names of local bindings to their values." | |
[] | |
(let [symbols (map key @clojure.lang.Compiler/LOCAL_ENV)] | |
(zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols))) | |
(declare *locals*) | |
(defn eval-with-locals |
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
(import '(javax.sound.midi MidiSystem Synthesizer)) | |
(defn play-note [synth channel note-map] | |
(let [{:keys [note velocity duration] | |
:or {note 60 | |
velocity 127 | |
duration 1000}} note-map] | |
(. channel noteOn note velocity) | |
(Thread/sleep duration) | |
(. channel noteOff note))) |
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 jquerytest.core) | |
(def jquery (js* "$")) | |
(jquery | |
(fn [] | |
(-> (jquery "div.meat") | |
(.html "This is a test.") | |
(.append "<div>Look here!</div>")))) |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
;; Lee Spector ([email protected]) 20111018 - 20120819 | |
;; 20111113 update: handles functions of different arities | |
;; 20120819 update: forked this from evolvefn.clj and removed eval | |
(ns evolvefn_noeval | |
(:require [clojure.zip :as zip]) | |
(:use [clojure.walk])) | |
;; This code defines and runs a genetic programming system on the problem |
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
# Configs | |
config defaultToCurrentScreen true | |
config nudgePercentOf screenSize | |
config resizePercentOf screenSize | |
config secondsBetweenRepeat 0.1 | |
config checkDefaultsOnLoad true | |
config focusCheckWidthMax 3000 | |
config keyboardLayout dvorak | |
config windowHintsShowIcons true | |
config windowHintsIgnoreHiddenWindows false |
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 depr.core) | |
(defn ^:private !! [c] | |
(println "WARNING - Deprecation of " c " in effect.")) | |
(defmacro defn-deprecated | |
[nom _ alt ds & arities] | |
(let [silence? (:silence-deprecations (meta clojure.core/*ns*))] | |
(when-not silence? | |
(!! alt))) |
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
macro invert { | |
rule { { $x:ident <- $y:expr } } => { | |
$y(function($x) { return $x }) | |
} | |
rule { { $x:ident <- $y:expr $rest ... } } => { | |
$y(function($x) { | |
return invert { $rest ... } | |
}) | |
} | |
rule { { $y:expr } } => { $y } |
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 rhyme-txt | |
(map #(string/split % #"[ ]+") (string/split-lines (slurp "cmudict.txt")))) | |
(def word-to-rhyme | |
(reduce (fn [m [word & rhyme]] | |
(assoc m | |
(string/lower-case word) | |
(mapv #(keyword (string/replace %1 #"[0-9]" "")) (reverse rhyme)))) | |
{} rhyme-txt)) |
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
// A small SSH daemon providing bash sessions | |
// | |
// Server: | |
// cd my/new/dir/ | |
// #generate server keypair | |
// ssh-keygen -t rsa | |
// go get -v . | |
// go run sshd.go | |
// | |
// Client: |
OlderNewer