Skip to content

Instantly share code, notes, and snippets.

View rich's full-sized avatar

Rich Cavanaugh rich

  • Datalot, Inc.
  • Port Saint Lucie, FL
View GitHub Profile
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}
@rich
rich / redis-server
Last active December 14, 2015 19:29 — forked from tessro/redis-server
#!/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
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
def self.included(receiver)
receiver.named_scope :latest_before, lambda {|time| {:conditions => ['created_at < ?', time]}}
end