Skip to content

Instantly share code, notes, and snippets.

#Day 1

##Command line

clear OR ctrl + l

whoami

cd - home directory

# Building Ruby Familiarity
# In this exercise you will take a first look at some common commands in Ruby
# The idea here is to build familiary with Ruby syntax
# This will likely be the first time you've seen some of these commands
# Just type them in and see the displayed output
# Steps:
# 1. Open up a new terminal window
# 2. Launch irb

#"Day" 2.to_s

##Yesterday we were about

###Ruby

  • Types: strings, integers, floats, booleans
  • Collections: arrays
  • Variables
  • Assignment
@bitfidget
bitfidget / group-selector.rb
Created February 26, 2014 04:49
A way to select work groups from our class
# require "pry"
us=["Simon","Anne","Olly","Kriss","Nix","Tom","Erik","Charlie","Mark"].shuffle
print "How many people per group? "
group = gets.chomp.to_i
remainder = us.length % group
groups_total = (us.length - remainder)/group
@bitfidget
bitfidget / HerokuCommit.md
Created March 14, 2014 04:07
A quick rundown of committing to git and heroku

First make sure you have created your Gemfile and config.ru

Gemfile should contain something like:

source "http://rubygems.org" gem 'sinatra' group :development do gem 'pry' end

@bitfidget
bitfidget / HomeworkThisWeekend
Last active August 29, 2015 13:57
homework tasks for 2014/03/14
https://gist.github.com/wofockham/1000198e4ae7bed746ae
http://guides.rubyonrails.org/association_basics.html
to get the search thing going - the hint is 'substring'
also make all of this using MVC
wil require an associations db
book id | author id
@bitfidget
bitfidget / rails.md
Last active August 29, 2015 13:57
RAILS begins today...

all goodness starts with a simple line: rails new first_app -d postgresql (where 'first_app' is the folder name of the new app)

then go into the folder and add the basics: rails generate scaffold movie title:string in_theatres:boolean released:date rating:string description:text

go into config/database and chnage the username to match usenrame

back in terminal: rake db:create

then: rake db:migrate

@bitfidget
bitfidget / rails_begin.md
Last active August 29, 2015 13:57
Trying to keep up with the steps to start a rails project...

PAPER - work out what form all of your data will take- tables and field names

TERMINAL - rails new NAME -d postgresql

TERMINAL - cd into that NAME folder and subl .

SUBL - open your gemfile and add all the extra gems you want

eg. debugging gems cos they're awesome:

@bitfidget
bitfidget / raise_params_inspect
Created March 20, 2014 03:51
it's the new binding.pry
raise params.inspect
@bitfidget
bitfidget / deploy_to_heroku.md
Last active August 29, 2015 13:57
RAAAAAAaaaahhhh to heroku/git
  1. update database YML file with

production: adapter: postgresql encoding: unicode database: whatsat_production pool: 5 password:

  1. remove unneeded gems