Skip to content

Instantly share code, notes, and snippets.

View coleenhuang's full-sized avatar

coleenhuang

View GitHub Profile
https://coleenhuang.github.io/Ancient-Greece-quiz/greek-quiz-app
https://github.com/coleenhuang/Ancient-Greece-quiz
@coleenhuang
coleenhuang / Quiz app questions
Created September 23, 2019 16:38
Components and wireframe sketches of the quiz app
const questions = [
{ //Question 1
text: "Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος is the opening line of a famous work."
+ "What is that work called?",
answers: [
{
text: "Seven Against Thebes",
correct: false
},
{
@coleenhuang
coleenhuang / Shopping List Plans
Created September 11, 2019 16:23
Planning out how to implement the shopping list app
addItems(){
//Get imput value from the form
//Take the input value and put it in an object that is added to the array STORE
//STORE.push({name: item, checked: false})
}
checkItems(){
//use event listener on the check button
//change the value for the item in STORE from checked: false to checked: true
}
@coleenhuang
coleenhuang / Using gh-pages
Last active September 8, 2019 02:37 — forked from mandiwise/Sync gh-pages + master branches
Instructions for publishing to and using github pages
Publishing a project page for a project with existing repository
//Make sure you are in the local project repo
$ git checkout -b gh-pages
$ git push origin gh-pages
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
What are the ways that jQuery can be used to manipulate the appearance of a web page?
How do you use jQuery to add additional text to a web page?
Do you need to link to jQuery in the html file?
Is jQuery the only way you can interact with the DOM?
How would you extract information from forms with jQuery?
@coleenhuang
coleenhuang / Grokking
Created August 4, 2019 04:00
An explanation of how the code works
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
//converts all the letters in the string to lowercase, splits the string into an array of individual words, removes any falsy items, and sorts it all alphabetically.
}
function mostFrequentWord(text) {
let words = getTokens(text);
//calls the function getTokens and assigns the output to words
//makes words an array of the individual words from the argument, sorted alphabetically, in lowercase and without punctuation or spaces
@coleenhuang
coleenhuang / Scope
Created August 1, 2019 18:07
Variable Scope
Scope is where a variable can be accessed from in your program. Block scope means that the variable can only be accessed from within the block where it is declared. Whereas variables with global scope can be accessed from anywhere in the program.
Global variables are usually avoided due to the unintended side effects that can happen, which can often lead to bugs. Side effects are when a variable in a function reaches out of the local scope and changes the value of the global variable.
This can cause a function to become indeterminate, which means that it returns different values despite having the same inputs. A pure function is determinate, always returning the same values for the sames inputs, and has no side effects, so only changes variables within the local scope.
Strict mode triggers an error whenever a function is declared without let or const. It prevents you from accidentally declaring a global variable within a function.