This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
PSQL CHECKING COMMANDS | |
1. $psql | |
2. =# \l List All The DB's | |
2. =# \c dbname CHANGE TO IT | |
3. dbname=# \d List All The Relations | |
4. dbname=# SELECT * FROM relation_of_your_choice; |
This file contains hidden or 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
default: &default | |
adapter: postgresql | |
pool: 5 | |
timeout: 5000 | |
development: | |
<<: *default | |
database: first_rails |
This file contains hidden or 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
<h1>Sign Up</h1> | |
<%= form_for @user do |f| %> | |
<% if @user.errors.any? %> | |
<div class="error_messages"> | |
<h2>Form is invalid</h2> | |
<ul> | |
<% for message in @user.errors.full_messages %> | |
<li><%= message %></li> | |
<% end %> |
This file contains hidden or 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
http://www.ruby-doc.org/core-2.1.1/Enumerable.html#method-i-zip | |
add value to an array | |
users['Neel'][:favorite_numbers].push(64) or | |
users['Neel'][:favs] << 64 | |
add user to array | |
users['Jane'] = {:github => "janeplural", :nums => [58,48,44]} | |
.zip |
This file contains hidden or 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 UsersController < ApplicationController | |
def create | |
@user = User.new(user_params) | |
# ... | |
end | |
private | |
def user_params |
This file contains hidden or 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
colors = ["blue","green","seafoam"] | |
colors.each do |color| | |
puts "I love #{color.upcase}!" | |
end | |
even more simple... | |
[1, 2, 3].each do |item| | |
puts("Iterating over #{item}...") | |
end |
This file contains hidden or 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
sfd |
This file contains hidden or 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
module AnimalBodilyFunctions | |
def bark | |
puts "now i am currently barking deal with it..." | |
end | |
end | |
class DogBlueprint | |
include AnimalBodilyFunctions | |
attr_accessor :breed, :name |
This file contains hidden or 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
" Powerline on | |
set rtp+=/usr/local/lib/python2.7/site-packages/powerline/bindings/vim/ | |
" Always show statusline | |
set laststatus=2 | |
" Use 256 colours (Use this setting only if your terminal supports 256 colours) | |
set t_Co=256 |