http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
| #require 'active_support/core_ext' | |
| class YamlCompare | |
| def self.compare_keys first_file_info, second_file_info, results_location | |
| first_file = Hash.new | |
| second_file = Hash.new | |
| deltas_file = Hash.new | |
| File.open( first_file_info[:file_location] ) { |yf| first_file = YAML.load( yf ) } | |
| File.open( second_file_info[:file_location] ) { |yf| second_file = YAML.load( yf ) } | |
| first_file[first_file_info[:root]].each_pair do |k,v| |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
http://guides.rubyonrails.org/migrations.html
| # Additional translations at https://github.com/plataformatec/devise/wiki/I18n | |
| # Just to be clear: | |
| # Author: Ivan Stana, http://github.com/istana | |
| # License: MIT | |
| # Base file: devise.en.yml | |
| # Some elements taken from https://gist.github.com/MarosPixel/1295185 thx | |
| # For versions 2.2, 3.0, maybe other | |
| sk: |
Create a Gem - Make it a Command Line Interface - Add Rspec Tests Using Bundler & Thor
#Creating your own Gem
| ## | |
| # This files shows some possible implementations of the Singleton pattern | |
| # in Ruby. I'm not a huge fan of the Singleton pattern, but it's nice | |
| # in some cases. In this file I'm going to implement a simple logger. | |
| # | |
| ## | |
| # The first implementation that can come to our minds is to create a class | |
| # that holds an instance as a class variable that can be accessed through |
| class Player | |
| FULL_HEALTH = 20 | |
| def play_turn(warrior) | |
| @warrior = warrior | |
| if need_to_rest? | |
| if able_to_rest? | |
| warrior.rest! |
| CHECKING_OUT_BRANCH=$3 | |
| OLD_BRANCH=$1 | |
| NEW_BRANCH=$2 | |
| if [ $CHECKING_OUT_BRANCH -eq 1 ] | |
| then | |
| FILES_CHANGED=`git diff $OLD_BRANCH $NEW_BRANCH --name-status` | |
| MIGRATIONS_REMOVED=`echo "$FILES_CHANGED" | egrep 'D\tdb/migrate/([0-9]+)' | sort -r` | |
| MIGRATIONS_ADDED=`echo "$FILES_CHANGED" | egrep 'A\tdb/migrate/([0-9]+)'` | |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\