Skip to content

Instantly share code, notes, and snippets.

View deobald's full-sized avatar
🧀
eating cheese and being afraid

Steven Deobald deobald

🧀
eating cheese and being afraid
View GitHub Profile
@deobald
deobald / googlevice.rb
Created September 20, 2011 16:21
mark all texts as read in google voice
#!/usr/bin/env ruby
# this script is pretty shit, really, but if you switch it to delete it's an easy way to
# blast through your texts and clean up your inbox. the problem with it is that gvoice
# can get into an inconsistent state after about a dozen pages.
require 'rubygems'
require 'selenium-webdriver'
def signin
@deobald
deobald / callers.clj
Created June 14, 2011 22:22
Get a meaningful clojure call stack from anywhere.
(defn ignored? [classname]
(let [ignored #{"callers" "dbg" "clojure.lang" "swank" "eval"}]
(some #(s/substring? % classname) ignored)))
(defn callers []
(let [fns (map #(str (.getClassName %))
(-> (Throwable.) .fillInStackTrace .getStackTrace))]
(vec (doall (remove ignored? fns)))))
(defn append [list1 list2]
(if (empty? list1)
list2
(cons (first list1) (append (rest list1) list2))))
class ThreadTest < Test::Unit::TestCase
# ~ 340 microseconds per thread spin-up, regardless of `-J-Djruby.thread.pooling=[true|false]'
def test_some_speeds
@runs = 0
def func
@runs += 1
end