Code | Message | Symbol |
---|---|---|
1xx | Informational | |
100 | Continue | :continue |
101 | Switching Protocols | :switching_protocols |
102 | Processing | :processing |
2xx | Success | |
200 | OK | :ok |
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
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
# Continue only on 'master' | |
if [[ $CURRENT_BRANCH -ne 'master' ]]; then | |
exit; | |
fi | |
# Clone the branch and remove it's content | |
git clone -b gh-pages --single-branch https://github.com/<ORGENISATION>/<REPOSITORY>.git DOCS | |
rm -rf DOCS/* |
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 asyncExec = require('util').promisify(require('child_process').exec); | |
/** | |
* Execute command line in a child process | |
* @param {...String} args Commands | |
* @return {String} | |
*/ | |
async function exec (...args) { | |
const { stdout, stderr } = await asyncExec(...args); |
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
class Person { | |
constructor(firstName, lastName) { | |
Object.assign(this, {firstName, lastName}); | |
memoize.call(this, 'name', 'greeting', 'greet'); | |
} | |
get name() { | |
return [this.firstName, this.lastName].filter(part => !!part).join(' '); | |
} |
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
/** | |
* Send the form over http | |
* @param {HTMLFormElement} form | |
* @return {String|undefined} Error message or nothing | |
* | |
* Prevent form's organic submit, and send it here, instead | |
*/ | |
export default async function send(target) { | |
try { | |
const url = target.getAttribute('action'); |
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 monitorHeap({MAX_BYTES = 100, MAX_PERCENT = 90} = {}) { | |
if (!window.performance || !window.performance.memory || !window.requestAnimationFrame) { return; } | |
const MB = 1048576; | |
const MAX_MEMORY = MAX_BYTES * MB; | |
const MAX_PERCENTILE = MAX_PERCENT / 100; | |
function heapcop() { | |
const { usedJSHeapSize, jsHeapSizeLimit } = performance.memory; |
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 { onerror } = window; // Existing onerror handlers | |
// Trust others adhere to onerror handling rules | |
window.onerror = (...args) => { | |
let handled; // is someone else taking care this error? | |
try { | |
handled = onerror && onerror.apply(window, args); | |
} catch (error) { | |
// Catch others' onerror errors |
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 errorsHistory = []; | |
function abortErrorReport(message, file, line, column, error) { | |
// Close the log behind a rollout mechanism to protect your infrastructure | |
if (!errorLoggingEnabled) return true; | |
// Limit the amount of errors from one page | |
if (errorsHistory.length > 10) return true; | |
// Send the same error twice from the same page can create false multiplications |
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
/** | |
* This is the signature of the browser's built in onerror handler | |
* @param {string} message Error message | |
* @param {string} file Source file where the script threw an error | |
* @param {number} line Line number | |
* @param {number} column Column number | |
* @param {Error} error Error object | |
* @return {Boolean} Should the default event handler fire? | |
*/ | |
function myOnErrorHandler(message, file, line, column, error) { |
OlderNewer