Skip to content

Instantly share code, notes, and snippets.

@JackHowa
JackHowa / movieClub-idea
Created May 25, 2017 16:24
Movie Club is for opinionated movie watchers and their opinionated friends
Rotten Tomatoes api
IMDB api
google sheet integration for db management
basically a crud app with user reviews and comments
----------------------------------
console:
gem install bundler
rbenv local 2.2.2
bundle install
$ postgres -D /usr/local/var/postgres
FATAL: lock file "postmaster.pid" already exists
@JackHowa
JackHowa / active_record_howtos
Created May 3, 2017 21:04
active record here we go
# installing gems
gem install bundler
# install bundler should already be here on dbc machines
bundle install
# creating database
# makes two dbs - one for model, one test
bundle exec rake db:create
need a merge conflict xy_wing array maybe
or just assign the variables of the board from within the recursie loop because that's worked before with the lone single
change instance vars of positions to self.position
because that's the position for the current player
delete player instance variable then just pass players into the starting_position (formerly overwriting with position method)
make attr reader for position
use insert and to_s to the value
have a hash value be knowing the position and player name
@JackHowa
JackHowa / gist:2c3e1c5c8adbb6542b35d35e18cdc903
Created April 20, 2017 22:36
prime numbers refactor duke
require 'prime'
def prime_factors(number, output = [])
return [number] if number.prime?
# write def prime base case checker in method
# return output if number.prime?
factors = (2...number/2).to_a.select do |potential_factor|
number % potential_factor == 0
end
Just as it is the responsibility of our plain Ruby classes to instantiate new instances of themselves,
Active Record model classes are also responsible for instantiating instances of themselves
bundle exec rake console
@JackHowa
JackHowa / 20170413ActiveRecordsRetrieval
Created April 13, 2017 13:40
active records retrieve commands - week 3
$ bundle install
$ bundle exec rake db:create
$ bundle exec rake db:migrate
$ bundle exec rake db:seed
bundle exec rake console
Dog.all
@JackHowa
JackHowa / 20170412active_record_retrieving
Created April 12, 2017 23:05
retrieving active records
$ bundle install
$ bundle exec rake db:create
$ bundle exec rake db:migrate
$ bundle exec rake db:seed
@JackHowa
JackHowa / gist:ed9e579859ccecae49fc42ee675df051
Created April 12, 2017 22:23
20170412active_records-editing
Pre-release: Set up Database with Old Schema
$ bundle install
$ bundle exec rake db:create
$ bundle exec rake db:migrate
bundle exec rake generate:migration NAME=RemoveWeightFromDogs
class RemoveWeightFromDogs < ActiveRecord::Migration