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
ls=dir /B $1 | |
ip=ipconfig $* | |
y=yarn $* | |
yes=yarn start $* | |
yo=yarn outdated $* | |
yup=yarn upgrade-interactive --latest $* | |
yb=yarn build $* | |
gs=git fetch && git status $* | |
gps=git push $* | |
gpr=git pull --rebase --autostash $* |
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 function useAbortableAsyncResult<T extends any = any>( | |
fn: (signal: AbortSignal, clearData: () => void) => Promise<T>, | |
dependencies: DependencyList = [] | |
) { | |
const isMounted = React.useRef(false); | |
const abortController = React.useRef<AbortController>(); | |
const [isInitialized, setIsInitialized] = React.useState(false); | |
const [data, setData] = React.useState<T>(); | |
const [error, setError] = React.useState<Error>(); | |
const [isLoading, setIsLoading] = React.useState(false); |
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 qrcode = require('qrcode-terminal'); | |
const open = require('open'); | |
// setup your httpServer as you like (express.js) | |
// ... | |
// The '0.0.0.0' binding is important here, otherwise the addresses will not work | |
httpsServer.listen(1337, '0.0.0.0', () => { | |
for (const [_, addresses] of Object.entries(os.networkInterfaces())) { | |
const relevantAddresses = addresses.filter((a) => !a.internal && a.family === 'IPv4').map((a) => a.address); |
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
@import './variables'; | |
// @import "~bootstrap/scss/bootstrap"; | |
@import '~bootstrap/scss/_functions'; | |
@import '~bootstrap/scss/_variables'; | |
@import '~bootstrap/scss/_mixins'; | |
@import '~bootstrap/scss/_root'; | |
@import '~bootstrap/scss/_reboot'; | |
@import '~bootstrap/scss/_type'; |
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
alias yo=yarn outdated $* | |
alias yup=yarn upgrade-interactive --latest $* | |
alias yes=yarn start $* | |
alias yb=yarn build $* | |
alias y=yarn $* | |
alias gco=git checkout $* | |
alias gm=git merge $* | |
alias gcam=git commit -am $* | |
alias gs=git status $* | |
alias gps=git push $* |
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 cluster = require('cluster'); | |
const numCPUs = require('os').cpus().length - 1; | |
const {promisify} = require('util'); | |
const pbkdf2 = promisify(require('crypto').pbkdf2); | |
if (cluster.isMaster) { | |
const workers = []; | |
console.log(`Starting ${numCPUs} workers…`) | |
for (let i = 0; i < numCPUs; i += 1) { | |
workers.push(cluster.fork()); |
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 http = require('http'); | |
const {promisify} = require('util'); | |
http.get[promisify.custom] = function getAsync(options) { | |
return new Promise((resolve, reject) => { | |
http.get(options, (response) => { | |
response.end = new Promise((resolve) => response.on('end', resolve)); | |
resolve(response); | |
}).on('error', reject); | |
}); |
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
"use strict"; | |
import fs from 'fs'; | |
import express from 'express'; | |
import bodyParser from 'body-parser'; | |
import Handlebars from 'handlebars'; | |
import wkhtmltopdf from 'wkhtmltopdf'; | |
const app = express(); | |
app.use(bodyParser.json()); |