Skip to content

Instantly share code, notes, and snippets.

View index.txt
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from,
ruby-to-clojure.*/* functions can be obtained from the source files in this
If no method symbol is given, we use the following notation:

Keybase proof

I hereby claim:

  • I am mmcgrana on github.
  • I am mmcgrana ( on keybase.
  • I have a public key ASDXYWj0J0tYgYI1487IvTW794oGTH7eSp3V7_Ah5-dh1Ao

To claim this, I am signing this object:


An Gist

This is a thing:

def foo
  puts "bar" + :bat.to_s
mmcgrana / server.clj
Created Jan 8, 2012 — forked from anonymous/server.clj
http.server example
View server.clj
(ns http.server
(:require [vertx.http :as http]))
(def server (http/server))
(defn vertx-start
(-> server
(fn [req resp]
View handle.clj
(ns demo.handle
(:import (sun.misc Signal SignalHandler)))
(defn trap-signal [sig f]
(Signal/handle (Signal. sig)
(proxy [SignalHandler] []
(handle [_] (f)))))
(defn trap-shutdown [f]
(let [rt (Runtime/getRuntime)]
View gist:875759
#!/usr/bin/env bash
if [ "$1" == "repl" ]; then
CLASSPATH=$(lein classpath)
exec java $JAVA_OPTS -cp $CLASSPATH $JLINE clojure.main --repl
export LEIN_VERSION="1.4.2"
LEIN_PLUGINS="$(ls -1 lib/dev/*jar 2> /dev/null | tr \\n \:)"
View gist:805776
var sys = require('sys');
var fleetdb = require('./fleetdb');
var db = new fleetdb.Database();'');
var done = 0;
setInterval(function() {
if (done == 100000) {
View gist:805775
var sys = require('sys'),
fleetdb = require('./fleetdb');
var db = new fleetdb.Database();'');
done = 0;
for(var i=0; i<10000; i++) {
db.query(['ping'], function(status, data) {
done += 1;
# in one terminal
$ lein deps
$ lein run -m server

# in another terminal
$ curl -i http://localhost:8080/sync
$ curl -i http://localhost:8080/poll
$ curl -i http://localhost:8080/stream
$ ./wsclient ws://localhost:8080/websocket?name=bob
=> hi