Skip to content

Instantly share code, notes, and snippets.

View ivanacostarubio's full-sized avatar
💭
⚡️accelerating

Ivan ivanacostarubio

💭
⚡️accelerating
View GitHub Profile
@ivanacostarubio
ivanacostarubio / polymorphic.rb
Created May 16, 2012 18:01
How to implement polymorphic behavior
class Animal
def initialize
end
def talk
raise NotImplementedError("Subclass must implement abstract method")
end
end
class Cat
def talk
@ivanacostarubio
ivanacostarubio / open_close_principle.rb
Created May 22, 2012 21:08
A sample of the Open Close Principle
# THIS
def classrooms_in_same_building
return [] unless building
Classroom.where(:building_id => building.id)
end
#
# THIS VS THAT!
#
@ivanacostarubio
ivanacostarubio / software_abstractions.txt
Created May 22, 2012 23:23
Build the right software abstractions.
"Pick the right ones, and programming will flow naturally from design;
modules will have small and simple interfaces; and new functionality will
more likely fit in without extensive reorganization.
Pick the wrong ones, and programming will be a series of nasty surprises:
interfaces will become baroque and clumsy as they are forced to accommodate
unanticipated interactions, and even the simplest of changes will be hard to make."
MIT Professor Daniel Jackson
#/bin/sh
# this script greps .rb files on the the current directory recursively for a word displaying the line, line number and file path.
# greps recursively ruby files and displaing lines
grep -r -n --include="*.rb" $1 . |
# strip white spaces
tr -d ' '|
@ivanacostarubio
ivanacostarubio / .rspec
Created June 10, 2012 03:10 — forked from coreyhaines/.rspec
Loading just active record
--colour
-I app
A comment that sheds light on this comes from Steve Jobs, CEO of Apple:
When you start looking at a problem and it seems really simple, you don't really understand the complexity of the problem. Then you get into the problem, and you see that it's really complicated, and you come up with all these convoluted solutions. That's sort of the middle, and that's where most people stop....
But the really great person will keep on going and find the key, the underlying principle of the problem—and come up with an elegant, really beautiful solution that works.
That's what we wanted to do with Mac.
—from Insanely Great, written by Steven Levy
@ivanacostarubio
ivanacostarubio / gist:3291306
Created August 8, 2012 01:44
api_meals_response
[
{"_id":null,"created_at":"2012-08-07T05:00:00Z","date":"May","ingredients":"Coffee","updated_at":null,"user_id":null},
{"_id":null,"created_at":"2012-08-08T05:00:00Z","date":"May","ingredients":"Lentil Soup","updated_at":null,"user_id":null}
]
@ivanacostarubio
ivanacostarubio / gist:3291360
Created August 8, 2012 01:56
meals_app_insights_response
{ "insights":[
{"_id":"50219791b31c8f2172000007","created_at":"2012-08-07T22:32:49Z","mensaje":"You are eating the perfect breakfast. Keep it up! ","score":null,"tag_line":null,"type":"happy","updated_at":"2012-08-07T22:32:49Z","user_id":"50202426b31c8f8c9e00000f"},
{"_id":"50218686b31c8f2172000006","created_at":"2012-08-07T21:20:06Z","mensaje":"Replace sugar in your coffee with cinnamon. ","score":null,"tag_line":null,"type":"warning","updated_at":"2012-08-07T21:20:06Z","user_id":"50202426b31c8f8c9e00000f"}
]
}
@ivanacostarubio
ivanacostarubio / rm_development_log.sh
Created August 10, 2012 00:43
Get rid of every development.log in your System mujajajaja
#/bin/sh
# This will find any development.log file and remove it
# <3
locate development.log | xargs -L1 rm
@ivanacostarubio
ivanacostarubio / gist:3517380
Created August 29, 2012 19:12
TMUX-Cheat-Sheet
TMUX:
http://www.openbsd.org/cgi-bin/man.cgi?query=tmux&sektion=1#end
http://www.youtube.com/watch?feature=player_embedded&v=4ErEBkj_3PY#t=888s
http://www.dayid.org/os/notes/tm.html