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 | |
# | |
# | |
# Quick and dirty script to extract some statistics about | |
# Rails core contributers. | |
# | |
# Usage: git_core_stats <path to rails git project> | |
# Example: git_core_stats ~/code/rails | |
# | |
# OR |
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
irb(main):001:0> require 'maruku' | |
=> true | |
irb(main):002:0> s = File.read('maruku-test') | |
=> "* Abacus\n * answer\n* Bubbles\n 1. bunk\n 2. bupkis\n * BELITTLER\n 3. burper\n* Cunning\n" | |
irb(main):003:0> doc = Maruku.new(s) | |
=> md_el(:document,[ | |
md_el(:ul,[ | |
md_el(:li,[md_par(["Abacus * answer"])],{:want_my_paragraph=>false},[]), | |
md_el(:li,[ | |
md_par(["Bubbles"]), |
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
# Script to watch a directory for any changes to a haml file | |
# and compile it. | |
# | |
# USAGE: ruby haml_watch.rb <directory_to_watch> | |
# | |
require 'rubygems' | |
require 'fssm' | |
directory = File.join(File.dirname(__FILE__), ARGV.first) | |
FSSM.monitor(directory, '**/*.haml') do |
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
// I'm confused about enveloping and 'blank frames'. | |
// One example from the ZMQ guide seems to have each envelope | |
// separated by an empty frame, and the other has one empty | |
// frame to deliminate the entire envelope stack. Which is | |
// correct? Or are there two different things going on here? | |
// LRU Queue example | |
s_sendmore (backend, worker_queue [0]); | |
s_sendmore (backend, ""); | |
s_sendmore (backend, client_addr); |
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 'stringio' | |
module EM::Bittorrent | |
module Benc | |
def self.decode(input) | |
Stream.new(input).decode | |
end | |
class Stream | |
def initialize(input) |
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
notification-realtime.core=> (require '[clj-hector.core :as hector]) | |
nil | |
notification-realtime.core=> (def cluster (hector/cluster "collectstream cluster" "localhost")) | |
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String; (NO_SOURCE_FILE: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
(defn read-bytes [input-stream n] | |
(loop [coll [] bytes-read 0] | |
(let [next-byte (.read input-stream)] | |
(if (or (= next-byte -1) (= bytes-read n)) | |
coll | |
(recur (conj coll next-byte) (inc bytes-read)))))) | |
user=> (read-bytes is 3) | |
[99 104 112] |
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
user=> [0xE2 0x80 0x99] | |
[226 128 153] | |
user=> (String. (into-array Integer/TYPE [0xE2 0x80 0x99]) 0 3) | |
"???" | |
user=> |
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 pallet-test.core | |
(:use | |
[clojure.contrib.command-line]) | |
(:require | |
[pallet.core :as core] | |
[pallet.compute :as compute] | |
[pallet.phase :as phase] | |
[pallet.crate.java :as java] | |
[pallet.crate.automated-admin-user :as automated-admin-user])) |
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
; SLIME 20100404 | |
user> (read-line) | |
nil | |
user> |