Skip to content

Instantly share code, notes, and snippets.

View haydenbr's full-sized avatar

Hayden Braxton haydenbr

View GitHub Profile
@haydenbr
haydenbr / cache-busting.js
Created October 5, 2017 17:51
ionic cache busting
#!/usr/bin/env node
var fs = require('fs'),
path = require('path'),
cheerio = require('cheerio'),
revHash = require('rev-hash');
var rootDir = path.resolve(__dirname, '../');
var wwwRootDir = path.resolve(rootDir, 'platforms', 'browser', 'www');
var buildDir = path.join(wwwRootDir, 'build');
@haydenbr
haydenbr / blob-generator-function.ts
Created July 23, 2020 22:45
Use a generator function to partition a blob and upload blocks sequentially to Azure Storage
async function putBlocks(blob: Blob, url: string): Promise<string[]> {
const blockIds: string[] = []
let baseUrl = url + '&comp=block'
for (let { block, blockId } of partitionBlob(blob, BLOCK_SIZE)) {
blockIds.push(blockId)
await fetch(`${baseUrl}&blockid=${blockId}`, {
...DEFAULT_FETCH_SETTINGS,
headers: {
@haydenbr
haydenbr / main.rs
Created September 8, 2023 02:30
Tracing Threads
use std::{thread, time::Duration, sync::Arc};
use tracing::{info_span, info, span};
use tracing_subscriber::EnvFilter;
use uuid::Uuid;
use dotenv::dotenv;
fn main() {
dotenv().ok();
tracing_subscriber::fmt()