Object come in two forms
- the declarative form (litral)
- Constrcted form
Declarative/litral Object
sudo apt-get install finger | |
sudo apt-get install openssh-server openssh-client | |
change ssh port if necessary: /etc/ssh/sshd_condig | |
sudo adduser student | |
#Give Sudo Privilages to the new user | |
visudo | |
# User privilege specification | |
newuser ALL=(ALL:ALL) ALL |
sudo systemctl disable nginx | |
sudo systemctl enable nginx | |
sudo systemctl stop nginx | |
sudo systemctl start nginx | |
sudo systemctl restart nginx | |
sudo systemctl reload nginx |
#To check the current directory | |
pwd - remote system | |
lpwd - local system | |
cd, lcd | |
# Copy the file from remote to local | |
get filename | |
~from local to remote |
1) Create a droplet | |
You will recieve an email with root password information. | |
2) login using ssh though your local remote terminal (find your ipaddress on the digital ocean droplet control panel) or use ssh authentication | |
ssh root@ipaddress | |
password:write from email | |
change password upon first login | |
3) Once login as a root. update latest ubuntu packages | |
sudo apt-get install update | |
sudo apt-get install upgrade | |
4) Add a non-root user with root previlagies |
#Import into database | |
sudo mongoimport --db newdb --collection restaurants --file primer-dataset.json | |
#export database collection | |
sudo mongoexport --db newdb -c restaurants --out newdbexport.json | |
# Take backup | |
create a folder regular backup folder | |
sudo mkdir /var/backups/mongobackups |
// 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; |
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; |
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". |
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 |