Skip to content

Instantly share code, notes, and snippets.

@tamalw
tamalw / tweet_beat.rb
Created July 25, 2008 22:10
Watch your keywords appear on the twitter stream
#
# tweet_beat.rb
# ShoesFest 2008
#
# Created by Tamal White on 2008-07-25.
# Copyright 2008 Tamal White. All rights reserved.
#
require 'hpricot'
# aldershot.rb
=begin
main file for aldershot mountain.
aldershot mountain is/will be a (currently)
simple chutes and ladders/snakes and
ladder/adders and ladders/moksha patamu/
gyanbazi/leela ripoff.
=end
@tamalw
tamalw / gist:2490
Created July 25, 2008 18:36
Messing around at ShoesFest!
# The goal is to have all the words on one line, with "shoes" bold, larger, and a different color
Shoes.app do
background black
# Looks okay
flow do
subtitle "I want new ",
strong("shoes", :stroke => chocolate),
require 'date'
class DateTime
def to_f
days_since_unix_epoch = self - ::DateTime.civil(1970)
(days_since_unix_epoch * 86_400).to_f
end
end
foo = DateTime.now

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

#!/bin.bash
regex='^[0-9]+$'
foo='1234'
bar='hi bean'
echo "foo = $foo"
if [[ "$foo" =~ $regex ]]; then
@tamalw
tamalw / dabblet.css
Last active August 29, 2015 14:27
Texas Flag
/**
* Texas Flag
*/
.texas {
margin: 3em;
width: 24em;
height: 16em;
box-shadow: 0px 0px 10px lightgray;
background: linear-gradient(rgb(255,255,255) 50%, rgb(191,10,48) 50%);
@tamalw
tamalw / dabblet.css
Last active August 29, 2015 14:27
Greece flag
/**
* Greece flag
*/
.greece {
margin: 3em;
width: 24em;
height: 16em;
box-shadow: 0px 0px 10px lightgray;
background: linear-gradient(rgb(0,97,242) 50%, rgb(255,255,255) 0);
@tamalw
tamalw / time_tz_monkeypatch.rb
Created August 14, 2008 17:54
Get the time in another timezone
require 'time'
class Time
def in(tz)
current_tz = ENV["TZ"]
ENV["TZ"] = tz
new_time = self.getutc.getlocal
ENV["TZ"] = current_tz
new_time
end
# Models
class Agent < ActiveRecord::Base
belongs_to :manager
belongs_to :site
belongs_to :workgroup
end
class Manager < ActiveRecord::Base
has_many :agents