Skip to content

Instantly share code, notes, and snippets.

say hi

brad oyler bradoyler

say hi
View GitHub Profile
bradoyler /
Last active Mar 24, 2020
Application Insights helper for typescript function apps

AppInsights helper

a typescript wrapper for Application Insights


Exception tracking

import { trackException } from './appinsights-helper'

trackException({ exception: error })
bradoyler /
Last active Mar 19, 2020
Simple Rest API client for node with support for JWT (bearer authentication) - requires Axios



const RestClient = require('./rest-client')
const client = RestClient({ baseURL: '' })
client.setAuthHeader('my-auth-token') // optional

const { data } = await client.get('/articles')
bradoyler /
Last active Mar 16, 2020
Flu Illness Cartogram


bradoyler /
Last active Mar 16, 2020
US Flights animation (Canvas2D)

Animating 3000 Flights using Canvas2D

Source code for animation used in #AirplaneMode

Orange dots = landing
Blue dots = takeoff

Config settings

var landingColor = '#fe761e';
bradoyler /
Last active Feb 5, 2020
Nodejs (6.x) standards

Node Standards (v6.x)

The 7 Commandments of Node:

  1. processes shall be small, and start instantly
  2. always communicate via message bus (Redis, RabbitMQ)
    • this is intended to avoid blocking IO like a slow HTTP request
  3. each process shall log to stdout
    • it's not the responsibility of the app to route logs
  4. a process shall not maintain state
    • avoid in-memory session ids, socket connections, etc
View allDateConversions.js
.filter(name => name.startsWith('to'))
.map(method => `${method}: ${(new Date())[method]()}`)
View numberToHsl.js
function numToColor (num, maxHue = 350, minHue = 0) {
const hue = num * (maxHue - minHue) + minHue
return `hsl(${hue}, 70%, 45%)`
bradoyler /
Created Sep 16, 2019
extract repo from git folder

git commands

git clone --mirror ssh:// filtered-repo
cd filtered-repo
git filter-branch --prune-empty --subdirectory-filter some/folder/path/ master
cd ..
git clone ./filtered-repo new-repo
cd new-repo
git status
bradoyler / csproj-scanner.js
Last active Jul 30, 2019
scan csproj files for usage of ProjectReference
View csproj-scanner.js
const glob = require('glob')
const fs = require('fs');
const xml2js = require('xml2js');
const path = require('path');
function parseFile (filePath, parser) {
fs.readFile(filePath, (err, data) => {
parser.parseString(data, (err, result) => {
const itemgroups = result.Project.ItemGroup;
if (itemgroups && itemgroups.length) {