"blocks aren't objects" and the corollary "blocks are objects"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
***********************************************HAPPY DAY************************************************** | |
Date: Oct 23 2010 | |
Happy Day | |
Happy Happy Day | |
When Your Happy Smile | |
In Your Face. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sure many of you wouldn't have heard before - | |
1. Zikr (Netaji Subhash Chandra Bose, Forgotten Hero) | |
2. Al Madath (Mangal Pandey) | |
3. Noor Un Alah (Meenaxi) | |
4. Marhaba ya mustafa (Al Risalah) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 10 | |
y = 0 | |
[1,2,3].each do |n| | |
x = n | |
y = y + n | |
end | |
y.inspect | |
# => "6" | |
n.inspect | |
# => "3" -- In 1.9.X this will be 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Float | |
def to_minutes | |
total_seconds = (self * 60).to_i | |
minutes = total_seconds / 60 | |
remaining_seconds = total_seconds % 60 | |
if remaining_seconds.to_s.size == 1 | |
"#{minutes}.0#{remaining_seconds}" | |
else | |
"#{minutes}.#{remaining_seconds}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
***************** Haml ************************ | |
%tr | |
%td{:colspan => 6} | |
%iframe{:name => 'for_directions', :id => "recipe_directions", :src => "#{url_for :action => :directions, :recipe_id => @recipe.id}", :width => "700px"} | |
**************** Script ********************** | |
$('#recipe_directions').load(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resource: http://jeremy.wordpress.com/2009/11/05/rspec-let-it-be/ | |
RSpec : let() it be | |
What I’ve found | |
A few minutes ago, I was watching a great screencast of Corey Haines doing a kata. | |
I stopped when he was refactoring a few similar assigments. There was something I’ve never seen elsewhere, particularly in the also great RSpec book ; he used the let() method. | |
Going back and forth a few times, I understood the the method was assigning the result of the given block to an object named after the argument of let(). |
(Some contents are from respective owners, not mine)
#What is git? Git is an open source, distributed version control system designed for speed and efficiency. Distributed version control means you don't checkout version of project, you clone it. Git clone means copy every bit on server to my local hard drive and let me work on database on locally. So it intends to be very fast because it is operated on locally.
#Which means Everything is very fast.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
OlderNewer