Current as at 25-Feb-2014
#Ruby Notes
###Terminology
Literals = values e.g. 1
or "Simon"
Variables = a place to store values
Operator = + - * / % =
Parameter = inputs for variables
Fix_num = an integer
Current as at 25-Feb-2014
#Ruby Notes
###Terminology
Literals = values e.g. 1
or "Simon"
Variables = a place to store values
Operator = + - * / % =
Parameter = inputs for variables
Fix_num = an integer
print "enter loan amount: " | |
loan = gets.chomp.to_i | |
print "Enter length of time in months: " | |
time = gets.chomp.to_i | |
print "Enter interest rate: " | |
rate = gets.chomp.to_f/100 | |
i = (1+rate/12)**(12/12)-1 | |
annuity = (1-(1/(1+i))**time)/i |
#WDI – DAY TWO
##RUBY
###RESOURCES www.ruby-doc.org Great documentation for Ruby
##Dependencies | |
#If you want to require library c when you install it it requires library d; | |
#Things you are depending on depend on other things; | |
##PACKAGE MANAGER SOLVES ALL OF THIS! | |
gem install package name #Will work out where to store it on your system, it will work out all the dependencies and go and download them; | |
#Some gems are very complicated such as ImageMagick, it depends on software that is written on your computer and not in ruby; | |
require 'sinatra' #only works if we have installed sinatra on our machine; |
##DEPLOYING TO HEROKU | |
#Create an account on Heroku | |
https://www.heroku.com | |
#Download Heroku Toolbelt (a client for generating and creating heroku apps); | |
https://toolbelt.heroku.com/ | |
heroku login #in the command line #It should generate SSH keys (we may have to do this manually); | |
#Gem list and check that you have the gem bundler; (You can do gem list | grep bundler); | |
#If you do not have it then install it: | |
gem install bundler #We have already done this; |
Current as at 18-MAR-2014
###HTTP Requests###
Contains… GET
###Controller
Current as at 18-MAR-2014
#Rails Notes
###HTTP Requests###
Contains… GET
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
TERMINAL - bundle