Skip to content

Instantly share code, notes, and snippets.

View h3nr1ke's full-sized avatar
🤔
Should I?

H3NR1KE h3nr1ke

🤔
Should I?
View GitHub Profile
@h3nr1ke
h3nr1ke / arrow_function_001.js
Created December 28, 2018 10:48
Function example
/**
*
*/
// Function in old style
function _myCoolFunction(param1, param2){
return param1 + param2;
}
// we can also declare it as a variable
@h3nr1ke
h3nr1ke / var_002.js
Last active December 24, 2018 12:37
var example ECMA6
/**
*
*/
_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
@h3nr1ke
h3nr1ke / const_004.js
Created December 24, 2018 12:20
const example with object.freeze
/**
*/
const OBJ = {
prop1 : 1,
prop2 : 2,
propA : "A",
propB : "B",
};
OBJ.prop1 = 3;
@h3nr1ke
h3nr1ke / const_003.js
Created December 20, 2018 17:09
const example ECMA 6
/**
* 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";
@h3nr1ke
h3nr1ke / const_002.js
Last active December 20, 2018 17:05
const example ECMA 6
/**
*
*/
const OBJ = {
prop1 : "foo",
prop2 : "bar",
prop3 : 100
}
console.log(OBJ);
@h3nr1ke
h3nr1ke / const_001.js
Created December 18, 2018 13:36
const example ECMA6
/**
*
*/
const DELAY = 1000; // a constant MUST be initialized
setTimeout(function(){
console.log("After 1 second…");
}, DELAY);
DELAY = 2000; // error
//END
@h3nr1ke
h3nr1ke / let_001.js
Created December 18, 2018 13:27
let example ECMA6
/**
*
*/
var _myVar = "Banana";
var _myFunction = function(){
_myVar = "Apple"
let _mySecondVar = "Avocado"
console.log("_myVar -> " + _myVar); 
console.log("_mySecondVar -> " + _mySecondVar); 
};
@h3nr1ke
h3nr1ke / var_001.js
Last active December 18, 2018 13:21
ECMA6 var example 0001
/**
*
*/
var _myVar = "Banana";
console.log(_myVar);
var _myFunction = function(){
 _myVar = "Apple";
 console.log("_myVar -> " + _myVar); 
};
_myFunction();
@h3nr1ke
h3nr1ke / ECDSA_HOST_KEY_ERROR
Created October 22, 2018 14:56
ERROR ECDSA host key for <IP> has changed and you have requested strict checking. Host key verification failed. devestapar@markVI:~/Documents/DEV/chav
# 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
@h3nr1ke
h3nr1ke / mysql.sh
Last active August 14, 2018 13:50
Access mysql remote server using command line
# if you dont have the tool
# apt-get install mysql-client
mysql -u [USER] -p[PASS] -h [REMOTE_HOST] [DATABASE_NAME]
# after this commmand, the prompt will be
# mysql>
# and will accept SQL commands
# mysql> Select * from yourtable;