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
/*jslint vars: true */ | |
// adapted from http://wiki.openstreetmap.org/wiki/Mercator#JavaScript | |
(function () { | |
var project = {}; | |
if (typeof exports === "object") { | |
module.exports = project; | |
} else { | |
this.project = project; |
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 "pr_geohash" | |
module GeoHash | |
RADIUS_OF_THE_EARTH = 6371 | |
RADIANS_CONVERSION_FACTOR = 180 / Math::PI | |
# decode geohash to a latitude/longitude point in the centre of the | |
# bounding box described by the geohash | |
def decode_point(geohash) |
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
import System.IO | |
import Data.List | |
import qualified Data.Map as M | |
import System.Random | |
import Data.Maybe | |
import Control.Applicative | |
main = do | |
contents <- readFile "messages.txt" | |
gen <- getStdGen |
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
class Markov | |
attr_reader :order, :phrases | |
def initialize(corpus=[], order=3) | |
@order = order | |
@phrases = Hash.new {|h,k| h[k] = []} | |
add(corpus) | |
end | |
def add(corpus) |
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
install_package "jruby-1.6.8.dev" "http://ci.jruby.org/snapshots/release/jruby-bin-1.6.8.dev.tar.gz" jruby |
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
source :rubygems | |
gem "activerecord", "3.1.4" | |
platforms :mri do | |
gem "mysql2" | |
end | |
platforms :jruby do | |
gem "activerecord-jdbcmysql-adapter" |
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 "eventmachine" | |
require "statsd" # statsd-ruby gem | |
module EventMachine | |
class Statsd < ::Statsd | |
class ConnectionWrapper | |
def initialize(em_connection) | |
@em_connection = em_connection | |
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
require "securerandom" | |
class RollingCounter | |
# :call-seq: RollingCounter.new(redis_client, max_window_seconds) -> counter | |
# | |
# Create a new counter instance, that will store/retrieve counts with | |
# +redis_client+ and return counts within the last +max_window_seconds+ | |
# seconds. | |
# |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>untitled</string> | |
<key>settings</key> | |
<array> | |
<dict> | |
<key>settings</key> |
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 'thread' | |
require 'rubygems' | |
require 'net/irc' | |
# undo weirdness in the net/irc library, so that we get NoMethodError when we | |
# call a method that doesn't exist | |
class Net::IRC::Client | |
remove_method :method_missing if defined? method_missing | |
end |