Skip to content

Instantly share code, notes, and snippets.

👍
Coding ...

Leo Lanese leolanese

👍
Coding ...
Block or report user

Report or block leolanese

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View !nocommit
# include this into the file: .git\hooks\pre-commit
# pre-commit to avoid debugger
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
no_color='\033[0m'
if git commit -v --dry-run | grep 'debugger' >/dev/null 2>&1
then
View gist:06acd13f5ac1d78615065044c71a2a7e
function isPalindrome(str) {
str = str.replace(/\W/g, '').toLowerCase();
return (str == str.split('').reverse().join(''));
}
console.log(isPalindrome("level")); // logs 'true'
console.log(isPalindrome("levels")); // logs 'false'
console.log(isPalindrome("A car, a man, a maraca")); // logs 'true'
@leolanese
leolanese / JavaScript Palindrome checker
Created Apr 19, 2019
JavaScript Palindrome checker
View JavaScript Palindrome checker
/*
JavaScript Palindrome checker
*/
// Example
const string1 = 'level',
const string2 = 'Le, vel.';
// Function can take up to two strings
const isPalindrome = (str1, str2) => {
@leolanese
leolanese / gist:b531169c374ab61cc9c5ed9dcff6e5b0
Created Feb 28, 2019
The function creates a new function that adds a delay in milliseconds to the execution of another function that is passed as an argument.
View gist:b531169c374ab61cc9c5ed9dcff6e5b0
function addDelay(func: () => void, ms: number) {
return () => {
setTimeout(() => {
func();
}, ms);
};
}
function sayHello() {
console.log('Hello world!');
View gist:3f1234fa5948b51c997361a2331b7bbe
DELETE LOCAL BRANCH
To delete the local branch use one of the following:
$ git branch -d branch_name
$ git branch -D branch_name
-=-=-=-=-=-
DELETE REMOTE BRANCH
@leolanese
leolanese / GIT_squashing
Created Dec 11, 2018
GIT SQUASHING (another branch):
View GIT_squashing
GIT SQUASHING (another branch):
ok, do work on branches branches … lalala
git add -A
git commit -m 'TEAM-XXX'
Switch to the master branch and make sure you are up to date:
git checkout master && git fetch && git pull
@leolanese
leolanese / GIT_Squashing
Created Dec 11, 2018
GIT Squashing (SAME BRANCH)
View GIT_Squashing
GIT Squashing (SAME BRANCH)
> let me rebase all commits for this branch (origin)
(Branch):
git add -A
git commit -m ‘ADCON-xxxx: lalalala'
git rebase -i master
@leolanese
leolanese / downgrade NODE using NVM
Created Nov 16, 2018
downgrade NODE using NVM (installing NVM)
View downgrade NODE using NVM
NVM
node -v
npm install -g nvm
export PATH=./node_modules/.bin:$PATH
git clone git://github.com/creationix/nvm.git ~/.nvm
printf "\n\n# NVM\nif [ -s ~/.nvm/nvm.sh ]; then\n\tNVM_DIR=~/.nvm\n\tsource ~/.nvm/nvm.sh\nfi" >> ~/.bashrc
NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm config delete prefix
@leolanese
leolanese / Function-overloading
Created Oct 23, 2018
Function overloading OOP
View Function-overloading
Function overloading OOP
// overload declaration
function sum(a: number, b: number): number;
function sum(a: string, b: number): number;
function sum(a: number, b: string): number;
function sum(a: string, b: string): number;
// overload definiton
function sum(a,b){
@leolanese
leolanese / angular-cli-version
Created Oct 23, 2018
UPGRADE & DOWNGRAGE angular-cli
View angular-cli-version
// UPGRADE
ng v
sudo npm uninstall -g angular-cli
sudo npm uninstall angular-cli
sudo npm cache verify
sudo npm install -g @angular/cli@latest
sudo npm install @angular/cli@latest
You can’t perform that action at this time.