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 net from 'net'; | |
export const isPortAvailable = (port: number): Promise<boolean> => { | |
return new Promise(resolve => { | |
const server: net.Server = net | |
.createServer() | |
.once('error', err => resolve(false)) | |
.once('listening', () => { | |
server.once('close', () => resolve(true)); | |
server.close(); |
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 bigInt = require('big-integer'); | |
let lookupTable: boolean[] = []; | |
export function sieve(table: boolean[], max: number): boolean[] { | |
console.time('generate lookup table'); | |
table.length = 0; | |
table[0] = false; | |
table[1] = 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
curl --request POST \ | |
--header 'Content-type: application/json' \ | |
--header 'Authorization: key=<server key>' \ | |
--data ' | |
{ | |
"to":"<receiver token>", | |
"notification": { | |
"title":"Title of your notification", | |
"body":"content of your notification" | |
}, |
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
# ---- Base image ---- | |
FROM node:8.9.4 AS base | |
RUN JOBS=MAX npm set progress=false && npm config set depth 0 | |
WORKDIR /workdir | |
COPY /package*.json . | |
COPY /.npmrc . | |
# ---- Build ---- | |
FROM base AS build |
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 path = require('path'); | |
module.exports = function (wallaby) { | |
process.env.NODE_PATH += path.delimiter + path.join(wallaby.projectCacheDir, 'packages'); | |
return { | |
files: [ | |
{ | |
pattern: "packages/**", |
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
# Find and replace text in multiple files | |
# http://www.24hourapps.com/2009/03/linux-tips-17-find-and-replace-text-in.html | |
# Multiple file find and replace is a rarely used, but an extremely time saving, ability of | |
# Linux that I cannot live without. It can be achieved by chaining a few commands together | |
# to get the list of files you want to change (find), make sure the files contain the strings | |
# you want to replace (grep), and do the replacements (sed). | |
# Lets say we have a lot of code that uses the function registerUser that was implemented when | |
# there was only one class of users, but now another class of users need to access the system |
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 db = require('kvstore'); | |
const console = require('console'); | |
export default (request) => { | |
const {channels} = request; | |
const queue = channels | |
.map((channelName) => { | |
console.debug(`Get counter for channel "${channelName}"`); |
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 * as React from 'react'; | |
interface IProps { | |
children: JSX.Element; | |
delay?: number; | |
} | |
interface IState { | |
wait: boolean; | |
} |
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
cl_crosshairalpha "255" | |
cl_crosshaircolor "5" | |
cl_crosshaircolor_b "50" | |
cl_crosshaircolor_r "50" | |
cl_crosshaircolor_g "250" | |
cl_crosshairdot "1" | |
cl_crosshairgap "0" | |
cl_crosshairsize "5" | |
cl_crosshairstyle "4" | |
cl_crosshairusealpha "1" |