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 NetworkError extends Error { | |
constructor(public message: string) { | |
super(message); | |
Object.setPrototypeOf(this, NetworkError.prototype); | |
this.name = 'NetworkError'; // Don't use "constructor.name" here because it won't work as expected when minifying the code ;) | |
this.stack = new Error().stack; | |
} | |
} | |
export {NetworkError}; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"/> | |
<title>HTML5</title> | |
</head> | |
<body> | |
<script> | |
const animals = ['Alligator', 'Bat', 'Chicken', 'Dolphin', 'Eagle', 'Flamingo', 'Guppy', 'Hedgehog', 'Iguana', 'Jaguar', 'Koala', 'Lion', 'Monkey', 'Narwhal', 'Owl', 'Peacock', 'Queen Bee', 'Rat', 'Sheep', 'Turtle', 'Unicorn', 'Vulture', 'Whale', 'Xantus', 'Yorkshire Terrier', 'Zebra']; | |
const orderedList = document.createElement('ol'); |
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
// https://www.hackerrank.com/challenges/compare-the-triplets/problem | |
function compareTriplets(a, b) { | |
const comparisonPoints = [0, 0]; | |
a.forEach((rating, index) => { | |
(rating > b[index]) ? comparisonPoints[0]++ : undefined; | |
(rating < b[index]) ? comparisonPoints[1]++ : undefined; | |
}); | |
return comparisonPoints; | |
} |
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 fs = require('fs'); | |
const glob = require('glob'); | |
const prettier = require('prettier'); | |
const path = require('path'); | |
// equivalent to "prettier --ignore-path .gitignore "**/*.{json,md,scss}" --list-different" | |
const editorConfig = path.join(process.cwd(), '.editorconfig'); | |
const filePattern = '**/*.{json,md,scss}'; | |
const gitIgnore = path.join(process.cwd(), '.gitignore'); |
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 url = 'https://app.wire.com/auth/?currency=eur&hl=en#createteam'; | |
function getUrlParameter(url, parameter) { | |
if (typeof window === 'undefined') { | |
return require('url').parse(url, true).query[parameter]; | |
} else { | |
return new URL(url).searchParams.get(parameter); | |
} | |
} |
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
{ | |
"dependencies": { | |
"": "" | |
}, | |
"devDependencies": { | |
"": "" | |
}, | |
"license": "UNLICENSED", | |
"main": "index.js", | |
"name": "example-puppeteer-travis-ci", |
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
// Note: Script must be executed from JS console when surfing on github.com to avoid CORS issues | |
var dependencies = { | |
"@bower_components/amplify": "wireapp/amplify#v1.1.6", | |
"@bower_components/antiscroll-2": "wireapp/antiscroll-2#v1.3.1", | |
"@bower_components/bazinga64": "wireapp/bazinga64#v5.0.3", | |
"@bower_components/bytebuffer": "dcodeIO/ByteBuffer.js#3.5.5", | |
"@bower_components/cryptojs": "brix/crypto-js#3.1.9-1", | |
"@bower_components/dexie": "dfahlander/Dexie.js#v2.0.4", | |
"@bower_components/generic-message-proto": "wireapp/generic-message-proto#v1.21.6", | |
"@bower_components/highlightjs": "components/highlightjs#9.12.0", |
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 {spawn} = require('child_process'); | |
const child = spawn('node', ['--version'], { | |
shell: true, | |
stdio: 'inherit', | |
}); | |
child.on('exit', () => { | |
console.log('Command finished.'); | |
process.exit(0); |
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 Promise = require('bluebird'); | |
Promise.config({ | |
cancellation: true | |
}); | |
const TIME_TO_WAIT_FOR_PROMISE = 1000; | |
const delayedPromise = new Promise((resolve, reject) => | |
setTimeout(() => { |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"lib": [ | |
"dom", | |
"es6" | |
], | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"outDir": "dist", | |
"removeComments": true, |