Skip to content

Instantly share code, notes, and snippets.

View johnkorzhuk's full-sized avatar

John Korzhuk johnkorzhuk

  • Sarasota, FL
View GitHub Profile
@johnkorzhuk
johnkorzhuk / .prettierrc
Created February 16, 2018 23:36
prettier config file
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"write": "src/**/*.js",
"jsxBracketSameLine": true
}
@johnkorzhuk
johnkorzhuk / .eslintrc
Last active March 25, 2018 23:42
.eslintrc file
{
"extends": ["airbnb", "prettier", "prettier/react"],
"rules": {
"react/jsx-filename-extension": [
"error",
{ "extensions": [".js", ".jsx"] }
],
"react/react-in-jsx-scope": 0,
"react/require-default-props": 0,
"react/forbid-prop-types": 1,
@johnkorzhuk
johnkorzhuk / gist:47276358f867fb915044822f4312f217
Last active May 23, 2017 13:40
Custom color setting vscode
"workbench.colorCustomizations": {
"editorGroup.background": "#FFFFFF",
"sideBar.background": "#FFFFFF",
"editor.selectionHighlightBackground": "#80CBC470",
"editor.selectionBackground": "#80CBC470",
"titleBar.activeBackground": "#FFFFFF",
"titleBar.inactiveBackground": "#ffffff",
"activityBarBadge.background": "#282a2eff",
"activityBar.foreground": "#282a2eff",
"activityBar.background": "#FFFFFF",
https://www.dropbox.com/sc/xjwlno4wj5moeve/AAAmrRy4yXnnqcGk8eSwj0GXa
@johnkorzhuk
johnkorzhuk / gist:9911de2660fd5feddee60d6c62c2d84e
Created March 1, 2017 17:52
Unit 3: Lesson 1: Event Listener Drills
https://jsbin.com/zarizom/1/edit?html,js,output
https://jsbin.com/zugiyag/1/edit?html,js,output
https://jsbin.com/rikuhid/1/edit?html,js,output
@johnkorzhuk
johnkorzhuk / gist:dcc6ce084058e1435351af1473d549c6
Created February 28, 2017 15:40
Unit 2: Lesson 6: analyzing most frequent program
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
/*
Passing .split a regular expression will split the string given the regex
Any of the characters inside the [] will result in a split. The + indicates that
more there may be more than one occurance of any of those characters (to be ignored)
array.sort() with no args. sorts according to each character's Unicode code point
value (alphabetically ...sorta)
@johnkorzhuk
johnkorzhuk / gist:683951ad218bfb49f93ab2282302255e
Created February 28, 2017 15:10
Unit 2: Lesson: 5: Object drills 2
https://jsbin.com/faqeme/2/edit?js,console
https://jsbin.com/yecilug/4/edit?js,console
https://jsbin.com/gikacu/2/edit?js,console
https://jsbin.com/madopo/14/edit?js,console
https://jsbin.com/qeqonom/5/edit?js,console
@johnkorzhuk
johnkorzhuk / gist:97649bdb33e014430d6554452a4fdfd8
Last active February 28, 2017 13:46
Unit 2: Lesson 6: object drills 1
https://jsbin.com/lamuqir/2/edit?js,console
https://jsbin.com/nupadar/2/edit?js,console
https://jsbin.com/qecixep/2/edit?js,console
https://jsbin.com/vopuga/2/edit?js,console
What is scope?
John Resig coauthored a book "Secrets of the JavaScript Ninja, second edition" that really solidified my understanding
of scope in javascript. Global and local/functional scope is a consequence of lexical environments and execution context (global and functional). If in a function an undeclared variable identifier is referenced, its outer lexical environment is checked for that variable, this is done until the global execution context is reached, if that variable is found, its reference is assigned to the inner identifier, if not, a global variable identifier is created.
Why are global variables avoided?
Global variable can cause identifier conflicts in a lot of unexpected ways.
Explain JavaScript's strict mode.
This forces the interpreter to be "more strict" with certain default javascript behaviors. i.e. referencing an undeclared variable from within a function will not create a global variable.
@johnkorzhuk
johnkorzhuk / gist:75ca8dcb9475b776c1418e7a218aaaa1
Created February 27, 2017 22:22
Unit 2: Lesson 4: array and loops drill
https://jsbin.com/xoyiyah/2/edit?js,console
https://jsbin.com/zidoqef/2/edit?js,console
https://jsbin.com/debafi/6/edit?js,console