This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Constant as an array | |
*/ | |
const OBJ = ["foo","bar"]; | |
console.log(OBJ); | |
// chaging the value of a constant "variable" =) | |
// no errors displayed | |
OBJ[0] = "another value"; | |
OBJ[1] = "example text"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
const OBJ = { | |
prop1 : "foo", | |
prop2 : "bar", | |
prop3 : 100 | |
} | |
console.log(OBJ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
const DELAY = 1000; // a constant MUST be initialized | |
setTimeout(function(){ | |
console.log("After 1 second…"); | |
}, DELAY); | |
DELAY = 2000; // error | |
//END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
var _myVar = "Banana"; | |
var _myFunction = function(){ | |
_myVar = "Apple" | |
let _mySecondVar = "Avocado" | |
console.log("_myVar -> " + _myVar); | |
console.log("_mySecondVar -> " + _mySecondVar); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
_myVar = "Banana"; // using a var before its is declared | |
console.log(_myVar); | |
var _myFunction = function(){ | |
_myVar = "Apple"; // using before the declaration | |
console.log("_myVar -> " + _myVar); | |
}; | |
_myFunction(); // calling the variable before the declaration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
var _myVar = "Banana"; | |
console.log(_myVar); | |
var _myFunction = function(){ | |
_myVar = "Apple"; | |
console.log("_myVar -> " + _myVar); | |
}; | |
_myFunction(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sometimes its possible to get this error when your are trying to connect to a remote server using ssh | |
#if the message appear | |
ERROR ECDSA host key for <IP> has changed and you have requested strict checking. | |
Host key verification failed. | |
# you can run | |
ssh-keygen -R <IP> | |
# Host<IP> found: line 19 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if you change the /etc/hosts and nothing happend... try flush the DNS cache | |
# OSX 10.9 + | |
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --- turn off | |
sudo mdutil -a -i off | |
# --- turn on | |
sudo mdutil -a -i on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#-- create the swap | |
sudo fallocate -l 1G /swapfile | |
#-- change permission | |
sudo chmod 600 /swapfile | |
#-- do the swap | |
sudo mkswap /swapfile |