This file contains 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
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 |
This file contains 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
function addDelay(func: () => void, ms: number) { | |
return () => { | |
setTimeout(() => { | |
func(); | |
}, ms); | |
}; | |
} | |
function sayHello() { | |
console.log('Hello world!'); |
This file contains 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
/* | |
JavaScript Palindrome checker | |
*/ | |
// Example | |
const string1 = 'level', | |
const string2 = 'Le, vel.'; | |
// Function can take up to two strings | |
const isPalindrome = (str1, str2) => { |
This file contains 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
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' |
This file contains 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
# 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 |
This file contains 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
node{ | |
stage('SCM Checkout'){ | |
git 'https://github.com/javahometech/my-app' | |
} | |
stage('Compile-Package'){ | |
// Get maven home path | |
def mvnHome = tool name: 'maven-3', type: 'maven' | |
sh "${mvnHome}/bin/mvn package" | |
} | |
This file contains 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
javascript: (function() { var elements = document.body.getElementsByTagName('*'); var items = []; for (var i = 0; i < elements.length; i++) { if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) { items.push(elements[i]); } } if (items.length > 0) { for (var i = 0; i < items.length; i++) { items[i].innerHTML = ''; } } else { document.body.innerHTML += '<style>* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\ * * { background-color: rgba(0,255,0,.2) !important; }\ * * * { background-color: rgba(0,0,255,.2) !important; }\ * * * * { background-color: rgba(255,0,255,.2) !important; }\ * * * * * { background-color: rgba(0,255,255,.2) !important; }\ * * * * * * { background-color: rgba(255,255,0,.2) !important; }\ * * * * * * * { background-color: rgba(255,0,0,.2) !important; }\ * * * * * * * * { background-c |
This file contains 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
javascript: (function() { var elements = document.body.getElementsByTagName('*'); var items = []; for (var i = 0; i < elements.length; i++) { if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) { items.push(elements[i]); } } if (items.length > 0) { for (var i = 0; i < items.length; i++) { items[i].innerHTML = ''; } } else { document.body.innerHTML += '<style>* { border: 1px solid red;}</style>'; } })(); |
This file contains 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
export const deepFreeze = (object: object) => { | |
const propNames = Object.getOwnPropertyNames(object); | |
for (const num of propNames) { | |
const value = object[num]; | |
object[num] = value && typeof value === 'object' ? deepFreeze(value) : value; | |
} | |
return Object.freeze(object); | |
}; |
This file contains 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
export const deepFreeze = (object: object) => { | |
const propNames = Object.getOwnPropertyNames(object); | |
for (const num of propNames) { | |
const value = object[num]; | |
object[num] = value && typeof value === 'object' ? deepFreeze(value) : value; | |
} | |
return Object.freeze(object); | |
}; |