Skip to content

Instantly share code, notes, and snippets.

View mechanicles's full-sized avatar

Santosh Wadghule mechanicles

View GitHub Profile
@mechanicles
mechanicles / gist:641883
Last active September 24, 2015 00:48
Manasi's Poem.
***********************************************HAPPY DAY**************************************************
Date: Oct 23 2010
Happy Day
Happy Happy Day
When Your Happy Smile
In Your Face.
@mechanicles
mechanicles / gist:1225067
Created September 18, 2011 13:23 — forked from anildigital/gist:1225047
Blocks aren't objects .....

"blocks aren't objects" and the corollary "blocks are objects"

blocks

@mechanicles
mechanicles / gist:1247093
Created September 28, 2011 05:55
A R Rahman
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)
@mechanicles
mechanicles / gist:1254506
Created September 30, 2011 17:58
Ruby Blocks features
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
@mechanicles
mechanicles / number_to_minutes_conversion.rb
Created October 19, 2011 05:19
Number to Minutes Conversion
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}"
@mechanicles
mechanicles / git_tips.md
Created November 2, 2011 09:19 — forked from fguillen/git_tips.md
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@mechanicles
mechanicles / gist:1339515
Created November 4, 2011 15:00
Set iframe height.
***************** 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() {
@mechanicles
mechanicles / gist:1347183
Created November 8, 2011 06:50
RSpec : let() it be
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().
@mechanicles
mechanicles / gist:1380265
Created November 20, 2011 13:22
What is git?

(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.

@mechanicles
mechanicles / gist:1443731
Created December 7, 2011 17:37 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end