Object come in two forms
- the declarative form (litral)
- Constrcted form
Declarative/litral Object
| // docker version | |
| docker --version | |
| // Pull image from docker hub | |
| docker pull wasfeng/whalesy | |
| // Run the pulled image or images already on the local system - Run the container from the image | |
| docker run wasfeng/whalesy | |
| // Stop the running docker container | |
| docker stop NAME(name of the container - assigned by the docker cli) | |
| // List all the running container | |
| docker ps |
| function createCircle(r) { | |
| let radius = r; | |
| this.draw = function() { | |
| console.log("draw the cirlce"); | |
| }; | |
| this.getRadius = function() { | |
| return radius; | |
| }; | |
| this.setRadius = function(val) { |
| // Object literals | |
| const obj = { | |
| radius: 1, | |
| location: { | |
| x : 1, | |
| y : 2 | |
| }, | |
| draw:function () { | |
| console.log('draw'); | |
| } |
| //plugins | |
| html-webpack-plugin -load javascript file dynamically | |
| clean-webpack-plugin -clean distribution folder. | |
| //css loaders | |
| style-loader | |
| css-loader | |
| # Temporary outage method | |
| sudo certbot --authenticator standalone --installer nginx \ | |
| -d <domain> --pre-hook "service nginx stop" --post-hook "service nginx start" |
| This is not an author-time binding but a runtime binding. | |
| this has nothing to do with where a function is declared, but has everthing to do with the manner in which the function is called. | |
| when a function is invoked, an activation record, otherwise known as an exection context, is created. | |
| it contains information about where the function was called from (the call-stack), how the function was invoked, what parameters where passed. etc. | |
| one of the properties of this record is this reference, which will be used for the duration of that function's execution. | |
| To understand the this binding, we have to understand the call-site. | |
| call site and call stack |
| Program state: the ability of a language to store value in a variable and later retrive or modify those values. In fact, | |
| the ability store values and pull values out of variables is what gives a program state. | |
| where do those variables live? | |
| where are they store? | |
| how does our program find them? | |
| The set of rules for storing varibales in some location, and for finding those variables at a later time is called scope. | |
| In traditional compiled-language, a chunk of source code, your program , will undergo typically three steps before it is executed, roughly called "compilcation". |
| You can think of clousre as a way of "remember" and continue to access a function's scope even once the function has finished running. | |
| function makeAddr(x) | |
| { | |
| //paraneter 'x' is an inner variable | |
| //inner function add() uses 'x', so it has clousre over it | |
| function add(y) | |
| { | |
| return x + y; |
| // desgin inspiration https://dribbble.com/shots/2324994-Daily-UI-Day-14-Countdown-Timer/attachments/442297 | |
| (function(){ | |
| let focusSecs; | |
| let breakSecs; | |
| let timer; | |
| let isPaused = false; | |
| let pausedSecs = 0; |