$ docker
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 async function requestWithRetry(requestFunc, errFunc, retryCount = 3) { | |
try { | |
return await requestFunc(); | |
} catch (err) { | |
if (retryCount <= 0) { | |
errFunc(err); | |
} | |
console.log('Request failed, retrying...'); | |
retryCount -= 1; |
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 | |
# ECHO COMMAND | |
# echo Hello World! | |
# VARIABLES | |
# Uppercase by convention | |
# Letters, numbers, underscores | |
NAME="Bob" | |
# echo "My name is $NAME" |
UPDATE (Fall 2020): This gist is an updated version to the Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL) guide, I usually just keep here notes, configuration or short guides for personal use, it was nice to know it also helps other ppl, I hope this one too.
Windows updated windows subsystem for linux to version 2, as the F.A.Q stated you can still use WSL
version 1 side by side with version 2. I'm not sure about existing WSL
machines surviving the upgrade process, but as always backup and 🤞. NOTE: WSL
version 1 is not replace/deprecated, and there ar
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
#!/usr/bin/env bash | |
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done | |
git fetch --all | |
git pull --all |
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
<?php | |
#API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'YOUR-SERVER-API-ACCESS-KEY-GOES-HERE' ); | |
$registrationIds = $_GET['id']; | |
#prep the bundle | |
$msg = array | |
( | |
'body' => 'Body Of 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
const findIP = (onNewIP) => { // onNewIp - your listener function for new IPs | |
// compatibility for firefox and chrome | |
const myPeerConnection = window.RTCPeerConnection || | |
window.mozRTCPeerConnection || | |
window.webkitRTCPeerConnection | |
const pc = new myPeerConnection({ iceServers: [] }) | |
const noop = () => {} | |
const localIPs = {} | |
const ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g |
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
// the main app file | |
import express from "express"; | |
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
import authenticate from "./authentication"; // middleware for doing authentication | |
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request | |
const app = express(), | |
api = express.Router(); | |
// first middleware will setup db connection |
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
//## Moment.JS Holiday Plugin | |
// | |
//Usage: | |
// Call .holiday() from any moment object. If date is a US Federal Holiday, name of the holiday will be returned. | |
// Otherwise, return nothing. | |
// | |
// Example: | |
// `moment('12/25/2013').holiday()` will return "Christmas Day" | |
// | |
//Holidays: |
NewerOlder