Skip to content

Instantly share code, notes, and snippets.

We wanted flying cars, instead we got GitHub status

Michael Klishin michaelklishin

We wanted flying cars, instead we got GitHub status
Block or report user

Report or block michaelklishin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
prasincs / sha1-hash.clj
Created Feb 15, 2011
clojure sha1 hash
View sha1-hash.clj
(defn get-hash [type data]
(.digest ( type) (.getBytes data) ))
(defn sha1-hash [data]
(get-hash "sha1" data))
(defn get-hash-str [data-bytes]
(apply str
ghoseb / with-retries.clj
Created Mar 18, 2011
Macro to retry executing some code in case of an exception
View with-retries.clj
(ns test)
(defn try-times
"Try executing a thunk `retries` times."
[retries thunk]
(if-let [res (try
(catch Exception e ; can be any exception
(when (zero? retries)
(throw e))))]
mislav / gist:938183
Created Apr 23, 2011
Faraday SSL example
View gist:938183
connection ='') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
# same as above, short form:
connection = ''
connection.get '/posts'
fritzek / gist:1009970
Created Jun 6, 2011
mail template about letting devs know that tests are failing because they aren't including rake in their gem file
View gist:1009970
Hey <github-handle>
Thanks that you run your test on Travis-CI.
Just to let you know: your tests failing because you haven't included rake in your Gemfile.
Please be so kind to add rake and your tests should run as you expect.
Thanks again for using Travis-CI
your Travis-Team
View gist:1134700
~/projects/jruby $ ant -q -Djruby.default.ruby.version=1.9
[echo] Updating
[echo] ...using git revision = 19f613b, tzdata = 2010k
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[javac] 1 warning
[apt] Since compiler setting isn't classic or modern, ignoring fork setting.
[apt] Since compiler setting isn't classic or modern, ignoring fork setting.
[jar] Warning: selected jar files include a META-INF/INDEX.LIST which will be replaced by a newly generated one.
FaKod / gist:1331556
Created Nov 1, 2011
The Neo4j Matrix Example with Neo4j-Scala
View gist:1331556
* The Matrix Example
case class Matrix(name: String, profession: String)
object TheMatrix extends App with Neo4jWrapper with EmbeddedGraphDatabaseServiceProvider {
ShutdownHookThread {
jorgenpt / jruby_timeout.rb
Created Nov 11, 2011
Workaround for JRuby's timeout not working well with IO.popen
View jruby_timeout.rb
# Workaround for IO.popen.readlines being allowed to block indefinitely even if
# wrapped in a Timeout::timeout call.
# Test case:
# $ time jruby -rtimeout -e "timeout(1) { IO.popen('sleep 10').readlines }"
require 'jruby'
module Timeout
def self.timeout(sec, klass=nil)
return yield(sec) if sec == nil or
michaelklishin / monger.querying.clj
Created Nov 14, 2011
Our new MongoDB query DSL in Monger, implemented in < 100 lines of Clojure
View monger.querying.clj
(with-collection "docs"
(find { :inception_year { $lt 2000 $gte 2011 } })
(fields { :inception_year 1 :name 1 })
(skip 10)
(limit 20)
(batch-size 50)
(hint "my-index-name")
jimbojsb / gist:1630790
Created Jan 18, 2012
Code highlighting for Keynote presentations
View gist:1630790

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

// Modified to call clojure code
public List<Contact> processFile(String fileName, BufferedReader input) {
List<Contact> contacts = new ArrayList<Contact>();
// for each line
Matcher m;
String email;
try {
List results = new spamlord().process(input);
You can’t perform that action at this time.