Skip to content

Instantly share code, notes, and snippets.

@laurenhavertz
Last active December 19, 2015 01:49
Show Gist options
  • Select an option

  • Save laurenhavertz/5878361 to your computer and use it in GitHub Desktop.

Select an option

Save laurenhavertz/5878361 to your computer and use it in GitHub Desktop.
WDI Action Adventure

case

like if else without all the if/else

case
  when then 
  when then 
  else
end
end
end
  • self = calling on the object

WEB APPS

CRUD Create Read Update Destroy (used with databases)

[2, 11, 37, 42]map! do |n|
n + 5
end
  • takes an array ([2, 11, 37, 42])
  • .map creates a new array
  • updates the new array with (n+5)
  • destroys the old array

RESTful Design representational state transfer

GET- Read POST - Create PUT - Replace Update PATCH - Merge Update (only to make one change) DELETE - Destroy

get "/movies"
get "/movies/:id"
post "/movies"
patch "/movies/:id/authors"
put "/movies/:id"
delete "/movies/:id"
  • most often used with http but used with JS, js.node, ruby, most platforms
  • when POSTing a new hash, the database will create a new id for the new item

*"Who is the fool? The fool who goes or the fool who follows him?" -Obiwan

*BACKEND- store and manipulate data *relationship between browser and web app

Databases

*Types of databases

  • json

  • realtion

  • sql

  • xml

  • spreadsheet (csv)

  • Key/Value

  • Brands *Mongo, SQLite, Postgress, Oracle

SQL

  • Sturucted Query Language
  • relational algebra symbols

*Select, Insert, Update, Delete

  • Classes = Tables(CSV)

  • Arrays = result set (several rows)

  • Hash(instance) = row

  • keys(properties/attributes) - column, field names

  • values = fields

  • schema all tables in a database

  • SELECT * FROM displays all the fields from that class

  • INSERT INTO "table name" (name the parameters) VALUES (specifics with the parameters)

  • WHERE more specific parameters

  • LIKE "dav%" will search for anything with those parameters

  • can look at all the products or all the users of the products

  • Ex. How to look up a specific users wishlist SELECT user_id, product_id FROM wishlists WHERE user_id = 9

  • EX. how to look up a specific product SELECT name FROM products WHERE id = 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment