Skip to content

Instantly share code, notes, and snippets.

View wjlroe's full-sized avatar
📷

William Roe wjlroe

📷
View GitHub Profile
@wjlroe
wjlroe / core.clj
Created February 12, 2014 20:19
How to parse complicated XML with no Internet requirements and no entity nonsense
(ns flaming-pidgeon.core
(:require
[clojure.xml :as xml]))
(defn startparse-sax-non-validating
[s ch]
(.. (doto (. javax.xml.parsers.SAXParserFactory (newInstance))
(.setValidating false)
(.setFeature "http://apache.org/xml/features/nonvalidating/load-dtd-grammar" false)
(.setFeature "http://apache.org/xml/features/nonvalidating/load-external-dtd" false)
@wjlroe
wjlroe / brew-confg.txt
Last active August 29, 2015 14:03
Dependency error installing pango without X11
% brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 8ef06725cf0b1dfa504515f4f7405798e7da846b
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit haswell
OS X: 10.9.3-x86_64
Xcode: 6.0 => /Applications/Xcode6-Beta2.app/Contents/Developer
@wjlroe
wjlroe / gist:6933a6c287629ad64299
Created July 15, 2014 09:14
nixops deploy -d trivial
*** Downloading ‘http://cache.nixos.org/nar/1bl9aq8brpq9pfy1rygfd4ns1nkk41kv6dh86wasrsy7p73nm3hc.nar.xz’ to ‘/nix/store/cjljpi8bvmgk8hs9nwpyrm3jib64pwn6-linux-3.14.12’...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
84 32.9M 84 27.8M 0 0 3030k 0 0:00:11 0:00:09 0:00:02 2647kerror: creating file `/nix/store/cjljpi8bvmgk8hs9nwpyrm3jib64pwn6-linux-3.14.12/lib/modules/3.14.12/kernel/net/netfilter/xt_dscp.ko': File exists
92 32.9M 92 30.3M 0 0 3017k 0 0:00:11 0:00:10 0:00:01 2536k
curl: (23) Failed writing body (0 != 1390)
download of `http://cache.nixos.org/nar/1bl9aq8brpq9pfy1rygfd4ns1nkk41kv6dh86wasrsy7p73nm3hc.nar.xz' failed: No such file or directory
could not download ‘/nix/store/cjljpi8bvmgk8hs9nwpyrm3jib64pwn6-linux-3.14.12’ from any binary cache
@wjlroe
wjlroe / core_test.clj
Last active August 29, 2015 14:05
Fizzbuzz without control structures
(ns fizzbuzzable.core-test
(:require [clojure.test :refer :all]
[clojure.test.check.clojure-test :refer [defspec]]
[clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[fizzbuzzable.core :refer :all]))
(defn boring-fizzbuzz
[n]
@wjlroe
wjlroe / Main.hs
Last active August 29, 2015 14:10
Problem using cabal test, detailed and Test.Framework
main :: IO ()
main = do
putStrLn "I have no idea what I'm doing"
module Main (main) where
import Test.Framework
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Your.Module (encrypt, decrypt)
prop_reverseReverse :: [Char] -> Bool
prop_reverseReverse s = (reverse . reverse) s == s
prop_encryptDecrypt :: [Char] -> Bool
@wjlroe
wjlroe / react-native-stacktrace.txt
Created April 7, 2015 16:37
Programming can be fun again with ReactJS Native!
RCTJSLog> "Error:
stack:
getComponentClassForElement index.ios.bundle:5802
_processProps index.ios.bundle:16220
mountComponent index.ios.bundle:15949
ReactCompositeComponent_mountComponent index.ios.bundle:4849
mountComponent index.ios.bundle:4918
mountChildren index.ios.bundle:19591
initializeChildren index.ios.bundle:17904
mountComponent index.ios.bundle:18058
Get Turbogears minor mode - like Rinari mode
#!/usr/bin/env ruby
project_root = "/Users/will/projects/random"
server_script = File.join(project_root, 'script', 'server')
pid1 = Process.fork {
exec "#{server_script} start"
}
Process.detach(pid1)
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.1
# Switch to 1.9.1 and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.1@rails3