Skip to content

Instantly share code, notes, and snippets.

View oaluna's full-sized avatar
💭
Job hunting!

Oscar Luna oaluna

💭
Job hunting!
View GitHub Profile
@oaluna
oaluna / gist:baab4dd4e72b6b7eaa7b7bb7d0ee1d9a
Created October 8, 2019 23:32
Variable Scope Questions
Scope is what defines a variable's access throughout certain parts of a code. If a variable's definition is within a block of instructions (like a function), then this variable is said to have block scope; its value can only be accessed within the block of instructions. If defined outside of a block of instructions, a variable is defined in the global scope, where its value can be accessed anywhere it is invoked. Whenever a definition is unavailable within the block scope, JavaScript will search up the scope chain, through parent scopes of a variable's function, for a definition. Variables declared at the global scope can be troublesome for this reason because it can lead to parent values being altered when running a code and make a function intederminate; it won't return the same value given the same input. Strict mode is a command that, when placed at the top of a JavaScript file, requires a contributor to use let or const when declaring a variable. Not doing so in Strict Mode will return an 'uncaught ref
@oaluna
oaluna / gist:9ae8a7940cfe78a3d70f4dbd3a7d2368
Last active October 12, 2019 15:37
Most Frequent Word Analyzer Challenge - Oscar Luna
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
}
function mostFrequentWord(text) { // this is our function that takes the argument text.
let words = getTokens(text); // this tells the computer that every true item in the text is a word
let wordFrequencies = {} //wordFrequencies is an array that iterates through the whole text.
for (let i = 0; i <= words.length; i++) {
if (words[i] in wordFrequencies) {
https://Traffic-lights-drill-1--oaluna.repl.co
https://repl.it/@oaluna/Error-alert-drill-1
https://repl.it/@oaluna/Creating-arrays-drill-1
https://repl.it/@oaluna/Adding-array-items-drills-1
https://repl.it/@oaluna/Accessing-array-items-drill-1
https://repl.it/@oaluna/Array-length-and-access-drill-1
https://repl.it/@oaluna/Array-copying-I-drill
https://repl.it/@oaluna/Array-copying-II-drill-2
https://repl.it/@oaluna/Squares-with-map-drill-2
https://repl.it/@oaluna/Sort-drill-1
https://repl.it/@oaluna/Filter-drill-1
https://repl.it/@oaluna/Find-drill-1
@oaluna
oaluna / gist:e1918c3b7dc47bfb157d7c4eaec6a2aa
Created November 6, 2019 23:06
Arrays And Loops Drills
https://repl.it/@oaluna/fizzbuzz-drill-js-1
https://repl.it/@oaluna/min-and-max-without-sort-drill-1
https://repl.it/@oaluna/average-drill-1
https://repl.it/@oaluna/Object-creator-drill-1
https://repl.it/@oaluna/Object-updater-drill-1
https://repl.it/@oaluna/Self-reference-drill-1
https://repl.it/@oaluna/Deleting-keys-drill-1
https://repl.it/@oaluna/validate-object-keys-drill-1
https://repl.it/@oaluna/find-by-id-drill-1
https://repl.it/@oaluna/Enroll-in-summer-school-drill-1
https://repl.it/@oaluna/Make-student-reports-drill-1
@oaluna
oaluna / cloudSettings
Last active July 6, 2021 01:12 — forked from scottdomes/app.css
React Audio Tutorial
{"lastUpload":"2021-07-06T01:12:24.654Z","extensionVersion":"v3.4.3"}
@oaluna
oaluna / System Design.md
Created January 3, 2020 04:12 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?