Skip to content

Instantly share code, notes, and snippets.

View coleenhuang's full-sized avatar

coleenhuang

View GitHub Profile
@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.
@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
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 / 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
@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 / 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
},
{
https://coleenhuang.github.io/Ancient-Greece-quiz/greek-quiz-app
https://github.com/coleenhuang/Ancient-Greece-quiz
@coleenhuang
coleenhuang / Portfolio site contents
Created September 29, 2019 15:21
Text for portfolio site
Headline
Hi, I’m Coleen Huang. I’m a web developer based in the Sacramento Area.
Bio
If you asked any of my friends to describe me, they would say that I’m a bibliophile, avid baker and someone who loves trying out different things.
I love coding, not only because of the opportunities that it gives me to learn and experiment, but also the satisfaction that I feel when I see my ideas come to life. I often feel like I never have time, as there’s so much that I want to learn. The current things that I’m working on mastering are coding, calligraphy and Ancient Greek.
Projects
Project title: Ancient Greece quiz app
Project description: Inspired by my love for Classics and Ancient Greece, I created this quiz app to test people on trivia about Ancient Greece
Clients are the people in the library, doing research, while the server is the library, which provides the books and information that the clients request.
1. Yes, most requests require authentication
2. Yes, CORS is supported by the API.
3. The response format is in JSON.
4. The limitation is that if you make too many requests in a short time frame you get throttled, but if this continues to happen you eventually get blocked.
5. The erros expected are: 400 Bad Request, 401 Unauthorized, 429 Too Many Requests, 500 Internal Server Error.