Skip to content

Instantly share code, notes, and snippets.

View laurenhavertz's full-sized avatar

laurenhavertz

View GitHub Profile
@laurenhavertz
laurenhavertz / yep.md
Created August 27, 2013 18:18
data structures

a.shift(8) = will create a new array and store it to memory

linked list: need a node structure and connected to other elements need anohter data type to keep track

definining the relationships through one another

advantages: less expensive, each node has its own properties

  • singly link list
@laurenhavertz
laurenhavertz / binary.md
Last active December 21, 2015 17:59
SCIENCE
  • base 10 = [0,1,2,3,4,5,6,7,8,9] => 10 options

  • base 2= [0,1] => 2 options

  • more numbers represented in base 10

  • computer is complicated system of on and off gates

  • opening and closing certain switches

goes in spots of 2(squared)

scope: attached to the model. Can be used in any part of rails or can be included with any association
ex. ` scope: completed, lambda { where(completed: true) }
# @list.items.completed.alphabetically
scope: completed.
collection proxy: Finders
- `class Item < AR::Base `
- inherits from active record
@laurenhavertz
laurenhavertz / Schema1.md
Last active December 21, 2015 09:19
Schema Design
@laurenhavertz
laurenhavertz / javascript.md
Last active December 21, 2015 02:09
JS RESOURCES
  • object literals dog = {}
  • constructor notion = var Dog = Action () var Dog = function (name, breed) { this.name = name this.breed = breed this.bark = function() { console.log('ruff ruff'); } }
@laurenhavertz
laurenhavertz / RailsApp2.md
Last active December 21, 2015 01:19
DOCUMENTATION

CONTROLLER ACTIONS

ITEMS CONTROLLER

  1. Create a User Controller rails g controller users in the terminal
  • Consider what you want your controller methods to do!
  1. Create a 'show' method def show @user = User.find(params[:id]) end
@laurenhavertz
laurenhavertz / js.md
Created August 13, 2013 17:58
JS RESOUCRCES
  • event driven computing:
  • multi-threaded process: create a new process for each incoming request (OLD WAY)
  • node.js: server side architechture (one single application)
    • should never wait for anything on the server side
    • process goes out from the database and blocks (waiting for request, TRADITIONALLY) - works now because hardware is so fast and so cheap/working for the wrong reasons
    • leveraging event driven computing from client
    • uses callbacks so knows then the server is done /returned by the name of callback ("success")
  • node.js has event loop: throw event into loop, get qued up, and when they are done, event loop knows that to do with the result(provided callback already)
@laurenhavertz
laurenhavertz / PaperClip.md
Last active December 20, 2015 18:29
RUBY GEMS

PreReqs:

  • install image magick brew install imagemagick <- in the terminal
  • gem install paperclip
  • gem install aws-sdk
  • think if you want 2 buckets: 1 for development and 1 for production
  1. rails new paperclip demo
  2. add gems to the Gemfile gem 'paperclip' gem 'aws-sdk'
@laurenhavertz
laurenhavertz / Capybara.md
Last active December 20, 2015 12:39
RUBY GEMS

Unit Test

  • test one method at a time
  • test one file at a time

Integration Test

  • view tests
  • think about user

Other uses

  • can test filling in _forms
@laurenhavertz
laurenhavertz / railsapp.md
Last active December 20, 2015 11:59
DOCUMENTATION

Things to consider

  • what do you want to build?
  • what do you want your project to have? ie. do you want your app to save data? are you using an APi?
  1. Create a visual model and relationships between them
  2. Create views (what pages do you want to see? what do they contain?)
  3. In the terminal rails new rtodo
  4. Move into new "Rtodo" folder cd rtodo
  5. open directory in sublime subl .
  6. Create User model rails g model user MAKE SURE THIS IS SINGULAR