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 'socketIO' | |
client = SocketIO.connect("https://socketio.mtgox.com/mtgox") do | |
before_start do |f| | |
on_disconnect { p "disconnected"} | |
on_connect { emit("connect", nil); p "connected" } | |
on_heartbeat { p "."} | |
on_message { |msg| p msg } | |
on_json_message { |json| p json} |
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/sh | |
# | |
# redis - this script starts and stops the redis-server daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Redis is a persistent key-value database | |
# processname: redis-server | |
# config: /etc/redis/redis.conf | |
# config: /etc/sysconfig/redis | |
# pidfile: /var/run/redis.pid |
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
select | |
d.id, | |
coalesce(f.cnt, 0) as cnt | |
from | |
departments as d left join | |
(select department_primary, count(1) as cnt from faculty group by department_primary) as f | |
on f.department_primary = d.id |
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
def self.included(receiver) | |
receiver.named_scope :latest_before, lambda {|time| {:conditions => ['created_at < ?', time]}} | |
end |