Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Last active November 26, 2018 22:37
Show Gist options
  • Save harrisonmalone/1345bd4e4646efec452af3f8f20394b0 to your computer and use it in GitHub Desktop.
Save harrisonmalone/1345bd4e4646efec452af3f8f20394b0 to your computer and use it in GitHub Desktop.

Events

truth tables

XOR female and a male breeding example, you need a female and a male to have a baby, you need a truth and a false to return true

did &&, || and XOR tables

then did it with comparing 1's and 0's to get a result

& 0110
  0101
  ----
  0100

then we looked at converting binary to decimal

same as what we learnt a few weeks back

2^3 2^2 2^1 2^0
1    0   0   1
8    0   0   1
=> 9

also did binary to hex conversion

when converting a number to a different base in js we need to store it first, not the same as ruby

let num = 10000
num.toString(16)
=> '2710'

recap of rails routes and params

accessing a specific model instance using params :id

query_string = "?category=cats&sub=outdoor"
query_string = query_string.split("&")
query_string[0][0] = ""
cat1 = query_string[0].split("=")
cat2 = query_string[1].split("=")
hash = {}
hash[cat1[0]] = cat1[1]
hash[cat2[0]] = cat2[1]
=> {"category"=>"cats", "sub"=>"outdoor"}

using .split and passing them into a hash to simulate params

explaining request and response differences between using rails (to render a whole new page) and JSON to use the JSON data as our database and manipulating the page with events

events, recap on h1 event challenge yesterday

playing around with event listeners and seeing what exists

this is a great resource for looking at all the event listeners that exist

then looked at createElement

const item = document.createElement('li')
item.innerText = input.value 
list.appendChild(item)

psuedocode for adding elements to the dom

challenge for appending elements to a todolist

lots of examples of the todolist and solving it in different ways

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