Thursday, June 28, 2007
Wednesday, June 27, 2007
Appending text in Ruby
My coworker was just appending some text in Ruby and found something out:
While using the syntax '+=' the process of appending text took 1.8 seconds for this particular case. However, adding the text to an array and then converting the array to text took ~.9 seconds - almost a second difference. On further investigation the syntax '<<' also took ~.9 seconds.
In summary, use '<<' and not '+='
While using the syntax '+=' the process of appending text took 1.8 seconds for this particular case. However, adding the text to an array and then converting the array to text took ~.9 seconds - almost a second difference. On further investigation the syntax '<<' also took ~.9 seconds.
In summary, use '<<' and not '+='
Tuesday, June 26, 2007
assloads of capacity.
With hard work, strict storyboarding, and a computing capacity that is measured not in megs or gigs, but in assloads. - Wired
Monday, June 25, 2007
Friday, June 22, 2007
The bird is done.
We were referencing this on the way back from lunch. I love the way that the bird just poofs into a cloud of feathers.
Thursday, June 21, 2007
Worst movies ever
Someone put together a list of really bad acting in really bad movies.
My Uncle was in Troll 2 - possibly the worst movie. Ever. You should definitely watch it for the sake of awful-ness.
My Uncle was in Troll 2 - possibly the worst movie. Ever. You should definitely watch it for the sake of awful-ness.
Wednesday, June 20, 2007
Parkour
This is awesome. Incredibly inspiring to think that people - who on average seem to be getting less athletic can accomplish such feats of strength and agility.
If you've seen the newest bond movie(Casino Royale) - the opening chase scene gets its kicks from parkour.
Our aim is to take our art to the world and make people understand what it is to move.
—David Belle, BBC News
If you've seen the newest bond movie(Casino Royale) - the opening chase scene gets its kicks from parkour.
Our aim is to take our art to the world and make people understand what it is to move.
—David Belle, BBC News
Shoelaces?
Monday, June 11, 2007
Using Multiple Buttons in a Form
Sometimes, one button to rule them all just isn't good enough, and you need more than one button in a form. With Rails, it's surprisingly easy to set up multiple buttons on a form.
In the View, we'll have the form with three buttons: Button 1, Button 2 and Button 3
In the Controller, we'll use a case statement to decipher which button was pressed and redirect to the corresponding action.
def filter_reports
case params[:submit]
when "Button 1"
redirect_to :action => :button_1_action, :id => params[:id]
when "Button 2"
redirect_to :action => :button_2_action, :id => params[:id]
when "Button 3"
redirect_to :action => :button_3_action, :id => params[:id]
end
end
Awesome, now you can add as many buttons as you want/need to a form.
In the View, we'll have the form with three buttons: Button 1, Button 2 and Button 3
In the Controller, we'll use a case statement to decipher which button was pressed and redirect to the corresponding action.
def filter_reports
case params[:submit]
when "Button 1"
redirect_to :action => :button_1_action, :id => params[:id]
when "Button 2"
redirect_to :action => :button_2_action, :id => params[:id]
when "Button 3"
redirect_to :action => :button_3_action, :id => params[:id]
end
end
Awesome, now you can add as many buttons as you want/need to a form.
Friday, June 8, 2007
Subscribe to:
Comments (Atom)