Skip to content

Instantly share code, notes, and snippets.

View matthewrudy's full-sized avatar

Matthew Rudy Jacobs matthewrudy

View GitHub Profile
@matthewrudy
matthewrudy / gist:1632
Created July 23, 2008 09:49
starling vs RudeQueue benchmark
<<-BENCHMARK
A quick benchmark vs Starling
doesn't deal with contention
running in Production mode
with 50,000 pre-existing RudeQueue items
user system total real
rudequeue 49.060000 2.970000 52.030000 ( 77.439360)
starling - one 1.710000 0.890000 2.600000 ( 11.684323)
starling - many 1.170000 0.610000 1.780000 ( 16.830219) >> @starlings.length => 128
@matthewrudy
matthewrudy / MakeSpecsBetter
Created September 1, 2008 22:24
makeSpecsBetter presentation
"rake away the pain"
@matthewrudy
matthewrudy / crazy.rb
Created September 9, 2008 21:35
rails :include hack
def self.board_threads(opts={})
#-- a note from the author
# # this query is heavily optimized & indexed, as it's pretty common
# # the select column override needs changing if column order changes on any of these tables :(
SectionPosting.find(:all, {
:include => {:content => :user},
:select => 'section_postings.`content_id` AS t0_r0, section_postings.`section_id` AS t0_r1, section_postings.`lastreply` AS t0_r7, content.`id` AS t1_r0, content.`title` AS t1_r1, content.`content` AS t1_r3, content.`user_id` AS t1_r5, content.`type` AS t1_r7, content.`replies` AS t1_r8, users.`id` AS t2_r0, users.`username` AS t2_r1',
:limit => 10
}.merge(opts))
@matthewrudy
matthewrudy / gist:16302
Created October 11, 2008 17:44
JobsGoPublic ruby Developer required
******************************************
Ruby Developer Required @ JobsGoPublic.com
******************************************
==============================
The Company - JobsGoPublic.com
==============================
@matthewrudy
matthewrudy / additional.css
Created October 14, 2008 22:57
blog.matthewrudy.com
.post .photo div.caption blockquote {
font: Bold 28px Helvetica, sans-serif;
letter-spacing: -1px;
color: #666666;
}
.post .photo div.caption { font-size: 15px;
}
dl.blogroll {
describe "base" do
before(:each) do
@params = {}
end
describe "with an id" do
before(:each) do
@id = 23
@params[:id] = @id
end
@matthewrudy
matthewrudy / index.html
Created October 18, 2008 18:12
matthewrudy.com
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
<style type="text/css">
body {
font-family: arial, sans-serif;
SolrQuery.build(:keyword => "red OR yellow", :category => "toys", :price => 5..10)
returns
"(red OR yellow) AND category:(toys) AND price:([5 TO 10])"
def add(data, tree)
if tree.end_of_a_branch? && tree.ND?
tree << data # we add something to the tree
else
add(data, tree.branch1) # we recurse
add(data, tree.branch2)
end
return tree # we always return the tree
end
@matthewrudy
matthewrudy / maddy
Created November 30, 2008 23:28 — forked from roag/maddy
data Btree a = ND | Data a | Branch (Btree a) (Btree a)
deriving (Show,Eq)
data Dir = L | R
deriving (Show,Eq)
type Path = [Dir]
--- Part a)