September 2010
27 posts
1 tag
method missing mischief
Ruby has many cool language features that make it quite straightforward to implement dynamic behaviour. One of those features is method_missing. It’s in the Kernel module, which means it is available everywhere. When a method is called on an object in Ruby and that method does not exist on the object, the object calls method_missing on itself and passes in the method name, arguments, and a...
V8 garbage collection points towards not being... →
Shout out to the “Node.js is the answer to everything, and the tool for every job” zealots.
every time i go through my blog archive i think to myself, “fuck,...
– Brandon Fletcher
2 tags
I wrote a Twilio Ruby gem
Twilio is a wicked service that allows developers to build telephony into their applications without worrying about any of the telephony stuff. As long as your app speaks REST you’re good!
Unfortunately the official Ruby API wrapper library is janky as hell, e.g. how to make a call:
# Twilio REST API version
API_VERSION = '2010-04-01'
# Twilio AccountSid and AuthToken
SID = 'ACXXXXX'
TOKEN...
Peter Thiel Has New Initiative To Pay Kids To... →
brandonthegreat:
“Thiel is starting a new initiative that will offer grants of up to $100,000 for kids to drop out of school. Yes, you read that right. Though that’s not how Thiel puts it. Instead, he calls it “stopping out of school.”
The basic gist is that he will fund up to 20 kids under the age of 20 who apply for this grant. His hope, obviously, isn’t to ruin their lives, but instead to...
7 tags
I just made a phone call from the command line
I used a new Twilio gem that I wrote for my latest project. It goes a little something like this:
Twilio::Call.create :to => '+19175551234',
:from => '+19175550000',
:url => 'http://example.com/api'
If you’ve ever used Twilio in Ruby before, you’ll know how much straightforward that is compared to the official library. I’m...
3 tags
Give me Infinity
In Ruby, dividing a kind of Integer, e.g a Fixnum or Bignum by 0 will result in a ZeroDivisionError. Make the divisor and/or the dividend a float, e.g. 1.0/0, 1/0.0, 1.0/0, or 1.0/0.0 and an exception will not be raised, the quotient returned will be Infinity.
It can be quite useful, I used this today for some discount code, i.e. sometimes a discount should never be applied.
ruby-1.9.2-p0 >...
Now available for contract work!
While I work on my startup. Contact me if interested.
email: sjtgraham <!— at — > mac <!— dot —> com
github: http://github.com/stevegraham
5 tags
Woot!
Just had my first patch committed to Ruby on Rails. It makes ActiveRecord::Base.find faster.
commit: http://bit.ly/9zrqS0
Thanks to José Valim for committing it!
revenge is a dish best served at zero degrees...
New Twitter has Gist Support!
Holy shit!
thechangelog:
This is just too awesome.
/via Yehuda Katz
my friend brandon fletcher ladies and gentlemen…
brandonthegreat:
A few days ago I got a Range Rover, and for some reason the iPod dock didn’t work. I have to listen to music while I drive, so I decided to create something real quick to cruise with.
If you’re on Facebook, you can watch the video in high quality here. And add me while you’re at it.
The MIT Sloan Sports Conference →
Sports fans, quants, and statisticians get together to talk about numerical analysis in sport.
I want to go.
7 tags
Apple Engineer Laurent Sansonetti confirms Apple... →
Hear the sound of Ruby developers around the world gearing up for not one but TWO lucrative, hungry markets competing for their skills: Web apps and iOS development.
Time to turn the money printing press up to 11 kids!
5 tags
Array#map_with_index
Further on from my colleague Craig Webster’s post. I saw that a lot of people have wanted Array#map_with_index over the years. I found the existing implementations to be unnecessarily complex. Ruby allows something much simpler.
class Array
def map_with_index &blk
enum_with_index.map &blk
end
alias :collect_with_index :map_with_index
end
%w(one two three).map_with_index do...