Skip to content

Instantly share code, notes, and snippets.

@MrNanosh
MrNanosh / init.vim
Created December 7, 2019 17:51 — forked from celso/init.vim
Neovim setup for OSX users
syntax on
set ruler " Show the line and column numbers of the cursor.
set formatoptions+=o " Continue comment marker in new lines.
set textwidth=0 " Hard-wrap long lines as you type them.
set modeline " Enable modeline.
set esckeys " Cursor keys in insert mode.
set linespace=0 " Set line-spacing to minimum.
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
" More natural splits
set splitbelow " Horizontal split below current.
//makes an array of tokes-> objects and other keywords that arent falsey no upper case
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
return rawString.toLowerCase() //lower case
.split(/[ ,!.";:-]+/) // using a Regex splits array into array indeces that are separated by any of the following: [ ,!.";:-]+
.filter(Boolean) //filter returns an array that is a modified version of this object. only items that evaluate to true using the Boolean conversion function are passed to the new array This means that anything that is false is removed. this is a bit redundant as taking a string and splitting it already encapsulates falsy stuff in ''. Any falsy keywords are caught by error handling. passing an empty string will however result in undefined opposed to getting thru as '' as it normally is falsy. it also filters empty arrays[] but not a weird one `${{}}` which are "[object".
.sort(); //sorts by alphabetical and numberical ascending by default
}
function
https://repl.it/@MrNanosh/Make-student-reports-drill
https://repl.it/@MrNanosh/Enroll-in-summer-school-drill
https://repl.it/@MrNanosh/find-by-id-drill
https://repl.it/@MrNanosh/validate-object-keys-drill
Alternate solution for drill 4: https://repl.it/@MrNanosh/validate-object-keys-drill-2nd-way
https://repl.it/@MrNanosh/Object-creator-drill
https://repl.it/@MrNanosh/Object-updater-drill
https://repl.it/@MrNanosh/Self-reference-drill
https://repl.it/@MrNanosh/Deleting-keys-drill?lite=1
What is scope? Your explanation should include the idea of global vs. block scope.
Scope is realm of influence of a variable. So long as var is avoided the only two scopes to be concerned with are global and block. variables declared with either let or const can exhibit both types of scope. Generally a variable declared in either way is defined within the block where it is declared and by extension any of the blocks nested within like russian dolls. Blocks are between curly "{}" braces. Any variable that is redefined within an inner block without being re-instantiated will be redefined for the outter block as well.
Global variables are defined and instantiated outside of any function and can be seen by even other javascript files that are loaded after the original. This means that they are defined and incidentally re-definable in every other block that is loaded after!
Why are global variables avoided?
Global files should be avoided because of the general problem of unintended concequences. Glbal variables
https://repl.it/@MrNanosh/min-and-max-without-sort-drill
https://repl.it/@MrNanosh/average-drill
https://repl.it/@MrNanosh/fizzbuzz-drill-js
https://repl.it/@MrNanosh/Creating-arrays-drill
https://repl.it/@MrNanosh/Adding-array-items-drills
https://repl.it/@MrNanosh/Accessing-array-items-drill
https://repl.it/@MrNanosh/Array-length-and-access-drill
https://repl.it/@MrNanosh/Array-copying-I-drill
https://repl.it/@MrNanosh/Array-copying-II-drill
https://repl.it/@MrNanosh/Squares-with-map-drill
https://repl.it/@MrNanosh/Sort-drill
https://repl.it/@MrNanosh/Filter-drill
https://repl.it/@MrNanosh/Find-drill
@MrNanosh
MrNanosh / assignment_solutions_js-v1_checkpoint_8
Created September 2, 2019 06:37
assignment solutions for /js-v1/checkpoint/8 thinkful
https://repl.it/@MrNanosh/Traffic-lights-drill
https://repl.it/@MrNanosh/Error-alert-drill
@MrNanosh
MrNanosh / assignmentSolutions_js-v1_chckpoint_7
Created September 1, 2019 22:12
assigned drills for: js-v1/checkpoint/7
https://repl.it/@MrNanosh/area-of-a-rectangle-drill
https://repl.it/@MrNanosh/temperature-conversion-drill
https://repl.it/@MrNanosh/Is-divisible-drill
@MrNanosh
MrNanosh / Assignment-js-v1Checkpoint6
Created September 1, 2019 18:06
Assignment-js-v1Checkpoint6 assignment for javascript intro pre-course for thinkful bootcamp
Links to solutions:
https://repl.it/@MrNanosh/Wiseperson-generator-drill
https://repl.it/@MrNanosh/shouter-drill
https://repl.it/@MrNanosh/text-normalizer-drill