| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
| require 'sinatra' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'sinatra/json' | |
| require 'json' | |
| # sets the view directory correctly (to make it work with gists) | |
| set :views, Proc.new { File.dirname(__FILE__) } | |
| class Store < ActiveRecord::Base | |
| has_many :employees | |
| validates :name, | |
| presence: true, | |
| length: {maximum: 25} | |
| integer_and_not_negative = { | |
| numericality: { | |
| only_integer: true, | |
| greater_than_or_equal_to: 0 |
| require 'active_record' | |
| require 'pg' | |
| ActiveRecord::Base.logger = Logger.new(STDOUT) | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => "postgresql", | |
| :host => 'ec2-54-204-41-178.compute-1.amazonaws.com', | |
| :username => 'bmdjwluxchptuq', | |
| :password => 'aEH-cKdr2zoXYUAjI8Xjma5eXK', |
| class ORM | |
| def save | |
| table_name = self.class | |
| instance_variable_names = self.instance_variables.map do |i| | |
| i.slice(1, i.length) | |
| end | |
| instance_variable_values = self.instance_variables.map do |i| | |
| self.instance_variable_get("#{i}") |
Take control of your development environment by using more of the keyboard and less of the mouse/trackpad. As you write your code, use (Mac and Sublime) keyboard commands/shortcuts to, well... kill it!
Mastering your text editor and Operating System (OS) will make you a more efficient and impressive developer.
Don't just read about these. If any of these are foreign / unfamiliar to you, be sure to practice them and make a mental note to use them when possible.
Your cofounder has left for Hawaii and asked that you take care of his puppy for 2 weeks.
As it turns out, this dog is a menace and won’t stop barking. His name is Shakil. He exhibits the following inexplicable behavior:
If you say anything to him, he will just bark back once ("woof"), except:
- If you pretend to be a dog and bark ("woof") at him, he will go a bit nuts and woof back at you three times, pretty loudly: "WOOF WOOF WOOF"
- If you explicitly use his name and tell him to stop (either "shakil stop" or "Shakil STOP!") he will not respond back with a bark (enjoy your moment of peace)
- If you pretend to be a cat and "meow" at him, he will go berserk and woof back at you five times: "woof woof woof woof woof"
- If you say anything else but with the word "treat" thrown into the mix, he won’t bark back, thinking he’ll be getting a treat
- If you say "go away" he manages to actually leave you alone by leaving the room.