Skip to content

Instantly share code, notes, and snippets.

View kbaribeau's full-sized avatar

Kevin Baribeau kbaribeau

  • Test Double
  • Saskatoon, SK, Canada
View GitHub Profile
@kbaribeau
kbaribeau / gist:9027116
Created February 15, 2014 23:58
v8 error when calling it with dieter using ns-resolve
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000116e2a1c2, pid=22721, tid=3335
#
# JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libv8wrapper.dylib+0x21c2] run+0x22
#

Keybase proof

I hereby claim:

  • I am kbaribeau on github.
  • I am kbaribeau (https://keybase.io/kbaribeau) on keybase.
  • I have a public key whose fingerprint is 6F0A C3A6 C635 CC33 AE73 79C3 E3BE 88EC BB7C E3A8

To claim this, I am signing this object:

def foo
s = "something complicated"
do_other_stuff
s
end
def bar
"something complicated".tap do
do_other_stuff
end
@kbaribeau
kbaribeau / gist:2e33e540627677198150
Created January 20, 2015 17:54
count returns nil
(def conn (d/connect "datomic:dev://localhost:4334/seattle"))
;44
(d/q '[:find (count ?id) .
:in $ ?c
:where
[?id :community/category ?c]]
(d/db conn)
"human interest")
@kbaribeau
kbaribeau / gist:61f47c00efc5133eef54
Last active August 29, 2015 14:18
simple clojure benchmarking
(defmacro bench [f]
`(let [start# (System/currentTimeMillis)
result# ~f
end# (System/currentTimeMillis)]
(println (str "bench result: " (- end# start#) "ms"))
result#))
@kbaribeau
kbaribeau / global-replace
Created February 8, 2011 22:50
the grep garbage is because sed likes to add newlines to the ends of files that don't already end in a newline
find . -type f -name \*.rb -exec grep -qi "foo" {} \; -print |xargs sed -i "" -e "s|foo|bar|g" -e "s|Foo|Bar|g"
@kbaribeau
kbaribeau / gist:851314
Created March 2, 2011 17:22
run a set of ruby specs based on a git grep search
git grep 'thing_to_search_for' | grep spec | grep -v vendor | grep rb: | awk '{print $1}' | sed -e 's/.$//' | uniq | xargs spec
@kbaribeau
kbaribeau / gist:853446
Created March 3, 2011 20:16
Run all failing cucumber scenarios from a hudson log
curl http://url-to-hudson-log | grep -A 5 'Failing Scenarios' | grep ^cucumber | awk '{print $2}' | sed -e 's/^.*\(\/features.*\)$/\1/' | sed -e 's/^.//' | xargs script/cucumber
@kbaribeau
kbaribeau / gist:938215
Created April 23, 2011 03:10
Tail recursive and non-tail recursive implementations of reverse and factorial in clojure
(defn recursive-reverse [coll]
(if (= 0 (count coll))
[]
(concat (recursive-reverse (drop 1 coll)) (take 1 coll))))
(defn recursive-reverse [coll]
(loop [coll coll
acc []]
(if (empty? coll)
acc
@kbaribeau
kbaribeau / gist:1158770
Created August 20, 2011 06:44
Download all DAS screencasts
#!/bin/bash
set -e
for file in `curl -s https://www.destroyallsoftware.com/screencasts/catalog |
grep screencasts |
tail -n +6 |
grep '(' |
cut -d '"' -f 2`; do
filename=$(echo $file | cut -d '/' -f 4)