Skip to content

Instantly share code, notes, and snippets.

@ryanbriones
ryanbriones / gist:900169
Created April 3, 2011 04:10
more crap I had on my desktop. Messing with graphs to implement twitter timelines that don't include retweets from people you've blocked. End goal was to store it in a key-value store like redis and see how painful it was to implement a graph on top of re
require 'set'
class Vertex
attr_reader :out, :in
def initialize(properties = {})
@properties = properties
@out = Set.new
@in = Set.new
end
@ryanbriones
ryanbriones / gist:900168
Created April 3, 2011 04:07
trying to understand binary trees using Ruby. had this on my desktop, wanted it off, but didn't want to lose it
class BinaryTree
def initialize
@size = 0
@root = nil
end
def insert(data)
node = BinaryTreeNode.new(data)
if @root.nil?
print "a"
STDOUT.flush
sleep 5 # doing work
print "\bb"
STDOUT.flush # doing more work
sleep 2
Username = <%= @var %>
@ryanbriones
ryanbriones / gist:821356
Created February 10, 2011 21:14
For the record, this is confusing...
class MyClass
def foo
end
private
def self.bar
end
end
@ryanbriones
ryanbriones / gist:808938
Created February 3, 2011 02:39
some jQuery to cycle through web fonts
function setGlobalFont(fontName) {
console.log('setting font to ' + fontName);
document.body.style.fontFamily = fontName + " !important";
}
$(document).ready(function() {
$.fonts = [
"Arial", "Verdana", "Geneva", "Helvetica", "Helvetica Neue",
"Georgia", "Palatino", "Times New Roman", "Times",
"Courier New", "Courier"
@ryanbriones
ryanbriones / gist:799139
Created January 27, 2011 20:08
Campfire emoji fortune cookie or conversation starter
emoji = %w(
+1 -1 bulb
calling clap cop
email feet fish
fist gift hammer
heart leaves lipstick
lock mag mega
memo moneybag new
ok pencil punch
runner scissors smoking
@ryanbriones
ryanbriones / gist:773909
Created January 11, 2011 02:37
Update on my mom 2011-01-10

Update on my mom 2011-01-10

So a lot of people have been asking for updates on my mom. Here are the basics:

  • Sunday 1/2 my mom was admitted to the hospital because she was having trouble breathing
  • When she was checked out at the hospital they found out she was severely dehydrated, malnourished and was in renal failure.
  • During the week there was really bad information coming out of the hospital.
  • In attempt to check out the status of her organs they tried to scope her, but ran into an issue. The real issue is still unknown.
  • They decided to send her to University Hospital in Tampa where her neck doctor could take a look at her. She had a full neck reconstruction last year and has had a few back surgeries over the last few years.
  • The doctors at UCH gave her a MRI and CT scan. They determined that her spine had collapsed due to the spread of infection most likely from the pneumonia they found. At this point my mom was near death.
class Company < ActiveRecord::Base
has_many :employees
end
class Employee < ActiveRecord::Base
has_one :position
belongs_to :company
end
class Position < ActiveRecord::Base
class ChattyHash < Hash
def []=(key, value)
puts "Hash:#{object_id}[#{key}] = #{value}"
super
end
def freeze
puts "Hash:#{object_id} frozen!"
puts caller.inspect
super