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
| hjkl - move around | |
| :#,#d - deletes between two lines, eg: :10,12d deletes lines 10 through 12 | |
| x - delete character | |
| o - insert on next line | |
| O - insert on preceding line | |
| a - insert after cursor | |
| i - go into insert mode | |
| w - move to beginning of next word (also W for whitespace delimited word) | |
| e - move to end of word (also E for whitespace delimited words) | |
| b - move backward to start of word (also B) |
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
| BEFORE: start trajectory story | |
| * run specific tests wrote (eg: rspec spec/decorators/event_decorator_spec.rb:5) | |
| rake | |
| git status | |
| git diff |
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
| def value | |
| @values = 0 | |
| Post.find(self.id).votes.each do |vote| | |
| if vote.vote_value == nil | |
| vote.vote_value = 0 | |
| else | |
| @values += vote.vote_value | |
| end | |
| 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
| ActiveRecord cheat sheet / EXAMPLES | |
| INSTALL | |
| ======= | |
| $ gem install activerecord | |
| in GEMFILE: gem ‘activerecord’ | |
| REQUIRE | |
| ======= | |
| require ‘active_record’ |
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
| <?xml version="1.0" encoding="utf-8" ?> | |
| <!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ --> | |
| <!-- Active URL: http://socrates.devbootcamp.com/sql.html --> | |
| <sql> | |
| <datatypes db="mysql"> | |
| <group label="Numeric" color="rgb(238,238,170)"> | |
| <type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/> | |
| <type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/> | |
| <type label="Single precision" length="0" sql="FLOAT" quote=""/> | |
| <type label="Double precision" length="0" sql="DOUBLE" re="DOUBLE" quote=""/> |
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
| <?xml version="1.0" encoding="utf-8" ?> | |
| <!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ --> | |
| <!-- Active URL: http://socrates.devbootcamp.com/sql.html --> | |
| <sql> | |
| <datatypes db="mysql"> | |
| <group label="Numeric" color="rgb(238,238,170)"> | |
| <type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/> | |
| <type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/> | |
| <type label="Single precision" length="0" sql="FLOAT" quote=""/> | |
| <type label="Double precision" length="0" sql="DOUBLE" re="DOUBLE" quote=""/> |
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
| require 'twilio-ruby' | |
| class Texter | |
| def initialize | |
| @account_sid = 'xxx' | |
| @auth_token = 'xxx' | |
| @client = Twilio::REST::Client.new(@account_sid, @auth_token) | |
| @from = 'xxx' | |
| 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
| puts "Welcome to console mad libs! First you'll enter 21 words, then you'll get a fun story, made by you!" | |
| puts | |
| goodAnswer = false | |
| while (not goodAnswer) | |
| puts "Are you ready to play? Type in 'yes' to begin." | |
| ready = gets.chomp.downcase | |
| if (ready == 'yes') | |
| goodAnswer = true | |
| else |
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 Board | |
| def initialize(board_input) | |
| @board_array = [] | |
| board_input.split(//).each_with_index do |cell, index| | |
| @board_array << Cell.new(cell, index) | |
| end | |
| end | |
| def find_box(cell_id) |
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 Array | |
| def new_collect | |
| result = [] | |
| self.each do |index| | |
| result << yield(index) | |
| end | |
| result | |
| end |