Skip to content

Instantly share code, notes, and snippets.


Prana Adiwira intrnl

View GitHub Profile
tannerlinsley / useGlobalMemo.js
Created Aug 28, 2020
useGlobalMemo is a React hook that lets you share memoizations across an entire app using a unique key.
View useGlobalMemo.js
const cache = {}
export default function useGlobalMemo (key, fn, deps) {
if (!cache[key]) {
cache[key] = {
subs: 0,
value: fn(),
developit / worlds-worst-jsx-transform.js
Created May 18, 2020
View worlds-worst-jsx-transform.js
* Write JSX, but make sure you have `import html from 'htm/preact'` in your files.
* Run them through this horrid attrocity and get JSX support with basically no overhead.
export function transformJsxToHtm(code) {
const tokenizer = /(^|)(?:<\/([a-z$_][a-z0-9_.-:]*)>|<([a-z$_][a-z0-9_.-:]*)(\s+[a-z0-9._-]+(?:=(?:".*?"|'.*?'|\{.+?\}))?)*(\s*\/\s*)?>|<(\/?)>)/gi;
let out='', index=0, token;
let depth = 0;
let stacks = [];
let shouldPop = false;
malarkey / Contract Killer
Last active Jan 15, 2021
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

You can’t perform that action at this time.