Skip to content

Instantly share code, notes, and snippets.

View marvinhagemeister's full-sized avatar
☀️

Marvin Hagemeister marvinhagemeister

☀️
View GitHub Profile
@marvinhagemeister
marvinhagemeister / measure.js
Last active June 16, 2021 13:19
minimal-preact-measure
import { options } from "preact";
function getComponentName(vnode) {
return vnode.type.displayName || vnode.name || "Component";
}
let prevBeforeDiff = (options._diff = options.__b);
options._diff = options.__b = (vnode) => {
if (typeof vnode.type === "function") {
const name = getComponentName(vnode);
@marvinhagemeister
marvinhagemeister / little-vdom-decompiled.js
Created March 8, 2020 14:13
Jason little-vdom decompiled
/* eslint-disable no-unused-vars */
/* eslint-disable no-else-return */
// JSX constructor, similar to createElement()
export const h = (type, props, ...children) => {
return {
type,
// Props will be an object for components and DOM nodes, but a string for
// text nodes
props,
@marvinhagemeister
marvinhagemeister / *valoo.md
Last active July 14, 2018 20:20 — forked from developit/*valoo.md
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.

@marvinhagemeister
marvinhagemeister / git-precommit.sh
Created January 7, 2017 00:28
Git pre commit lint only staged files
#!/usr/bin/env bash
BLUE='\033[1;34m'
BRIGHT_RED='\033[1;31m'
DARK_GRAY='\033[0;37m'
RESET='\033[m'
INFO="${BLUE}[INFO]${RESET}"
function task() {
if [ "$3" != "" ] && [ $1 ]; then