Skip to content

Instantly share code, notes, and snippets.

View bradoyler's full-sized avatar
👋
say hi

brad oyler bradoyler

👋
say hi
View GitHub Profile
@bradoyler
bradoyler / ai-post.md
Last active December 27, 2025 14:36
January AI News
title date modified description art layout tags
AI News Digest - January 2026
2026-01-30
roundup of the most notable AI developments
monthlyai.jpg
post.njk
blog
ai
@bradoyler
bradoyler / btc-post.md
Last active December 27, 2025 14:36
Crypto-January2026.md
title date modified description art layout tags
Crypto News Digest - January 2026
2026-01-30
roundup of the notable Crypto developments
monthlycrypto.jpg
post.njk
blog
crypto
@bradoyler
bradoyler / december-2025-crypto-digest.md
Created December 26, 2025 14:54
Crypto News Digest - December 2025
title date modified description art layout tags
Crypto News Digest - December 2025
2025-12-26
roundup of the most notable Crypto developments
cryptonews-december2025.jpeg
post.njk
blog
crypto
import NodeCache from 'node-cache'; // or 'redis'
class CacheService {
constructor(ttlSeconds) {
// this could also be redis
this.cache = new NodeCache({ stdTTL: ttlSeconds, checkperiod: ttlSeconds * 0.2, useClones: false });
}
get(key, storeFunction) {
@bradoyler
bradoyler / service-bus-test.js
Last active April 14, 2020 17:43
@azure/service-bus topic subscription test (send & receive) to confirm your subscription filters is working as expected
const { ServiceBusClient, ReceiveMode } = require('@azure/service-bus')
const connectionString = process.env['servicebus-connection']
async function send () {
const sbClient = ServiceBusClient.createFromConnectionString(connectionString)
const client = sbClient.createTopicClient('topic-name')
const sender = client.createSender()
// set label=TEST for use in subscription filter
const msg = { label: 'TEST', body: { foo: 'bar', ts: new Date() } }
@bradoyler
bradoyler / AppInsightsClient.ts
Last active March 25, 2020 02:35
Client for Azure Application Insights REST API
import * as rp from 'request-promise-native'
function convertTable (columns: any[], rows: any[]): any[] {
return rows.map((row: any[]) => columns.reduce((obj, col, idx) => {
obj[col.name] = row[idx]
return obj
}, {}))
}
// API reference @ https://dev.applicationinsights.io/reference
@bradoyler
bradoyler / 🧽.gif
Created March 16, 2020 01:03 — forked from EvanBacon/🧽.gif
🥓
🧽.gif
@bradoyler
bradoyler / README.md
Last active March 24, 2020 14:49
Application Insights helper for typescript function apps

AppInsights helper

a typescript wrapper for Application Insights

Examples

Exception tracking

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

trackException({ exception: error })
Object.getOwnPropertyNames(Date.prototype)
.filter(name => name.startsWith('to'))
.map(method => `${method}: ${(new Date())[method]()}`)
function numToColor (num, maxHue = 350, minHue = 0) {
const hue = num * (maxHue - minHue) + minHue
return `hsl(${hue}, 70%, 45%)`
}