Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mullr on github.
  • I am russellmull (https://keybase.io/russellmull) on keybase.
  • I have a public key whose fingerprint is 6C0E 6E48 D755 0E1E F75F 53B9 7173 804A 5B89 8BAC

To claim this, I am signing this object:

;;; Event loop
(def ^:dynamic *ui-events-chan* (chan))
(defn post-event [type cursor param]
(let [path (.-path cursor)]
(put! *ui-events-chan* [type path param])))
(declare handle-event)
(defn run-event-loop [root-cursor]
(go-loop []
(defprotocol KeyAddressable
(kv-seq [this]))
(extend-protocol KeyAddressable
cljs.core/PersistentVector
(kv-seq [v] (map-indexed (fn [n x] [n x]) v))
cljs.core/PersistentArrayMap
(kv-seq [x] (seq x))
(ns parsing
(:refer-clojure :exclude [==])
(:use [clojure.core.logic :exclude [is] :as l]
[clojure.test]))
(defn parseo [parser tokens remaining-tokens parse-tree]
(project [parser]
(parser tokens remaining-tokens parse-tree)))
(defn accept-p [x]
@mullr
mullr / gist:5671981
Created May 29, 2013 17:12
I hacked up a nice interface for linear programming in #clojure . Feels like it should go with core.logic, somehow.
(minimize (+ (* -2 x) y -5)
(<= (+ x (* 2 y)) 6)
(<= (+ (* 3 x) (* 2 y)) 12)
(>= y 0))
;=> {:y 0.0, :x 4.0}
(ns xml-test
(:use [clojure.test]
[clojure.data.zip.xml])
(:require [clojure.xml :as xml]
[clojure.zip :as zip]))
(defn parse-str [s]
(zip/xml-zip (xml/parse (new org.xml.sax.InputSource
(new java.io.StringReader s)))))
@mullr
mullr / gist:4108781
Created November 19, 2012 03:24
Bring xcode to front
#! /usr/bin/env osascript
tell application "Xcode"
activate
end tell
// hard-coded imperialism
if(! lang.equals("en")){
return;
}
@mullr
mullr / gist:3042515
Created July 3, 2012 19:53
Add a pre-compile step in leiningen
(use 'robert.hooke)
(use ['leiningen.compile :rename {'compile 'compile-task}])
(prepend compile-task
(prn "hello"))
(defproject ...)
@mullr
mullr / fixTemplates.rb
Created June 25, 2012 01:55
Remove headers from xCode templates
#!/usr/bin/ruby
require 'fileutils'
include FileUtils
files = `find /Applications/Xcode.app -path *.xctemplate/*.h -o -path *.xctemplate/*.m`.split("\n")
backupDir = File.expand_path "~/.xcTemplateBackup"
mkdir backupDir unless File.exists? backupDir