Skip to content

Instantly share code, notes, and snippets.

View stephenhuh's full-sized avatar
🏀
lykmike

Stevie Huh stephenhuh

🏀
lykmike
View GitHub Profile
@stephenhuh
stephenhuh / db.js
Created October 7, 2018 06:41
scratch
basicSelect = () => {
return knex('workouts')
.select('*')
}
basicFilter = (knex) => {
return knex
.where('workout_id', 1)
}
function decorateRBAC(fn) {
console.log('----start decorate-----');
console.log(...arguments);
console.log('fn-name:', fn.name);
console.log('----end-----');
return fn;
}
function withValidation(fn) {
const handlerName = fn.name;
@stephenhuh
stephenhuh / Counter.js
Created June 6, 2024 01:29 — forked from tannerlinsley/Counter.js
Global React State with Context and Immer
import { useCount, useIncrement, useDecrement } from './store.Count'
export default function Counter () {
const count = useCount()
const increment = useIncrement()
const decrement = useDecrement()
return (
<div>
<div>Count: {count}</div>
@stephenhuh
stephenhuh / index.ts
Created September 24, 2025 23:56 — forked from w00kie/index.ts
Cloudflare Worker that bundles R2 objects in a Zip file
import { z } from 'zod';
import { ZipWriter, BlobReader, configure } from '@zip.js/zip.js';
// Without this, we get uncaught error due to Workers runtime bug
// See: https://github.com/gildas-lormeau/zip.js/discussions/514
configure({
useCompressionStream: false,
});
// Payload schema that lists the files to be bundled, their filenames and the archive filename