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
(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
$ yardoc --help | |
Usage: yard doc [options] [source_files [- extra_files]] | |
(if a list of source files is omitted, | |
{lib,app}/**/*.rb ext/**/*.c is used.) | |
Example: yardoc -o documentation/ - FAQ LICENSE | |
The above example outputs documentation for files in | |
lib/**/*.rb to documentation/ including the extra files | |
FAQ and LICENSE. |
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' | |
require 'eventmachine' | |
module Console | |
PROMPT = "\n>> ".freeze | |
def post_init | |
send_data PROMPT | |
send_data "\0" | |
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
// http://www.ietf.org/rfc/rfc1928.txt | |
// Tested with: curl http://www.google.se/ --socks5 1080 --proxy-user foo:bar | |
var States = { | |
CONNECTED:0, | |
VERIFYING:1, | |
READY:2, | |
PROXY: 3 | |
}; |
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 'uri' | |
s1 = "http://storage.blah.com/auth28173" | |
s2 = "/container/path/to/object" | |
u = URI.parse(s1) | |
ary = s2.split('/') | |
ary.shift if ary[0].empty? |
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
Originally: | |
https://gist.github.com/7565976a89d5da1511ce | |
Hi Donald (and Martin), | |
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I | |
appreciate the tone. This is a Yegge-long response, but given that you and | |
Martin are the two people best-situated to do anything about this, I'd rather | |
err on the side of giving you too much to think about. I realize I'm being very | |
critical of something in which you've invested a great deal (both financially |
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 'fusefs' | |
paxosdir = DCell::Paxos::PaxosDir.new(DCell.registry.globals.root) | |
FuseFS.set_root(paxosdir) | |
# Mount under a directory given on the command line. | |
FuseFS.mount_under "/tmp/foobar" | |
FuseFS.run |
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
# | |
# Ideas stolen from lograge and brought to Rails 2.3 | |
# https://github.com/mattmatt/lograge/blob/master/lib/lograge/log_subscriber.rb | |
# | |
module ImprovedControllerLogging | |
def self.included(base) | |
base.alias_method_chain :log_processing, :fixup | |
base.inject_alias_method_chain :perform_action, | |
:perform_action_with_benchmark, |
OlderNewer