This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class IHazName | |
def initialize(name) | |
@name = name | |
end | |
end | |
zero = IHazName.new('zero') | |
one = IHazName.new('one') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns hiredman.beans) | |
(defn -it [& _] | |
[[] (ref {})]) | |
(defn setter [tis nam tat] | |
(dosync | |
(commute (.state tis) | |
assoc nam tat))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mbox.harpo.xmlrpc.XmlRpcRequestWrapper | |
(:gen-class | |
:extends javax.servlet.http.HttpServletRequestWrapper | |
:init init | |
:state state | |
:constructors {[javax.servlet.http.HttpServletRequest java.io.ByteArrayInputStream] | |
[javax.servlet.http.HttpServletRequest]}) | |
(:import | |
[java.io Reader ByteArrayInputStream] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns user | |
(:use | |
[clojure.contrib | |
(logging :only (debug info warn error fatal spy)) | |
[str-utils :only (re-gsub)] | |
[duck-streams :only (to-byte-array)] | |
[java-utils :only (set-system-properties as-properties read-properties)] | |
[pprint :only (pprint pp)]]) | |
(:require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use '[clojure.contrib [str-utils :only (re-gsub)]]) | |
(use '[clojure.contrib [java-utils :only (as-str)]]) | |
(defn #^String upcase | |
"upcases the initial character in s" | |
[s] | |
(let [string (as-str s)] | |
(apply str (Character/toUpperCase (first string)) (rest string)))) | |
(defn #^String camelize [s] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
gem 'zookeeper' | |
require 'zookeeper' | |
REQUIRED_NUMBER_OF_PROCESSES = 2 | |
class EventHandler | |
import org.apache.zookeeper.Watcher | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# -lt 1 ]]; then | |
echo "Usage $(basename $0) [-p] tagname" >&2 | |
echo 'the -p option will run `git push --tags` after creating the new tag' >&2 | |
exit 1 | |
fi | |
DO_PUSH='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DevNull | |
class FileEachWrapper | |
def initialize(io) | |
@io = io | |
end | |
def each | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.messages.find() | |
{ "_id" : "msgid:test:e9f1aca0-2d86-11e0-9695-138376569236", "status" : "incomplete", "expires" : 1296598229, "timeout" : 1296512429 } | |
{ "_id" : "msgid:test:f93bf066-2d87-11e0-ab0b-d7db09943f10", "status" : "incomplete", "expires" : 1296598684, "timeout" : 1296512884 } | |
> db.messages.find( { _id : "msgid:test:f93bf066-2d87-11e0-ab0b-d7db09943f10" } ) | |
{ "_id" : "msgid:test:f93bf066-2d87-11e0-ab0b-d7db09943f10", "status" : "incomplete", "expires" : 1296598684, "timeout" : 1296512884 } | |
> cmd = { | |
... findAndModify : "messages", | |
... query : { _id : "msgid:test:f93bf066-2d87-11e0-ab0b-d7db09943f10" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.messages.find( { _id : "msgid:test:f93bf066-2d87-11e0-ab0b-d7db09943f10" } ) | |
{ "_id" : "msgid:test:f93bf066-2d87-11e0-ab0b-d7db09943f10", "status" : "incomplete", "expires" : 1296598684, "timeout" : 1296512884 } | |
> cmd = { | |
... query : { _id : "msgid:test:f93bf066-2d87-11e0-ab0b-d7db09943f10" }, | |
... update : { $inc : { attempts : 1 } }, | |
... new : true, | |
... fields : { "_id" : 0, "attempts" : 1 } | |
... }; | |
{ | |
"query" : { |