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
#!/bin/bash | |
set -o errexit # Exit on error | |
git stash save 'Before deploy' # Stash all changes before deploy | |
git checkout deploy | |
git merge master --no-edit # Merge in the master branch without prompting | |
npm run build # Generate the bundled Javascript and CSS | |
if $(git commit -am Deploy); then # Commit the changes, if any | |
echo 'Changes Committed' |
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
# max user processes — linux, macos | |
ulimit -a | |
# max system processes — linux | |
cat /proc/sys/kernel/pid_max |
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
const element = $('.file-box:nth-child(2)') | |
const list = $$('.file-box') | |
function not($list, element) { | |
const list = Array.from($list); | |
const index = list.indexOf(element); | |
return list.slice(index); | |
} | |
Array.from(not(list, element)) |
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
REC - Recommendation | |
PR - Proposed Recommendation | |
CR - Candidate Recommendation | |
WD - Working Draft | |
ED - Editor's Draft | |
WIP - Worki In Progress |
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
/** | |
* Uses canvas.measureText to compute and return the width of the given text of given font in pixels. | |
* | |
* @param {String} text The text to be rendered. | |
* @param {String} font The css font descriptor that text is to be rendered with (e.g. "bold 14px verdana"). | |
* | |
* @see http://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393 | |
*/ | |
function getTextWidth(text, font) { | |
// if given, use cached canvas for better performance |
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
// 1) simple check | |
console.log(undefined === undefined); // true | |
// 2) check undefined param in function | |
(function (undef) { | |
console.log(undef === undefined); // true | |
}()); | |
// 3) unexists property | |
(function (obj) { |
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 getPeriod(period) { | |
var number, letter, letters, time; | |
if (typeof period !== "string") { | |
throw new Error("sorry, only string is correct, not " + typeof period); | |
} | |
/** | |
* Parse number from period. | |
* @type {number} |
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
/** | |
* TEST DATA | |
*/ | |
var testData = [{}, {a:1}, new RegExp(), [], Object.create(null), [undefined]]; | |
/** | |
* Check if param is Object? | |
* @param {*} o Checks value. | |
* @return {boolean} | |
*/ |