Skip to content

Instantly share code, notes, and snippets.

View mikkoh's full-sized avatar

Mikko Haapoja mikkoh

View GitHub Profile
@mikkoh
mikkoh / SKILL.md
Created June 16, 2026 14:39
code-factory: review-branch skill + agent definition
name review-branch
description Route natural-language PR reviewability requests to the review-branch agent. Use when the user asks to make a PR, branch, or large agent-generated change easier for humans to review, split into reviewable commits, add review guidance, create a temporary review branch, or replace a PR branch with a review-friendly commit sequence. This is about pull requests/code review, not public relations.

Review Branch Router

This skill is only a router. Its purpose is to recognize natural-language reviewability requests and start the review-branch agent.

Recursion guard

export default (paths) => {
const rules = [];
Array.prototype.forEach.call(document.styleSheets, (sheet) => {
Array.prototype.forEach.call(sheet.cssRules, (rule) => {
paths.forEach((path) => {
if (rule.selectorText && rule.selectorText.endsWith(`${path[0]}_${path[1]}`)) {
rules.push(rule);
}
});
fire();
setInterval(fire, 300);
setInterval(unfire, 500);
function fire() {
$('#can').trigger(TRUMP.main.events[0]);
}
@mikkoh
mikkoh / index.js
Last active December 1, 2015 01:28
requirebin sketch
var f1DOM = require('f1-dom');
var elButton;
var button;
// data-f1 defines an association with states
// which are later defined when creating an f1 instance
document.body.innerHTML =
'<div data-f1="elButton">' +
'<div data-f1="text">Im a button</div>' +
'</div>';
@mikkoh
mikkoh / index.js
Created December 1, 2015 01:17
requirebin sketch
var f1DOM = require('f1-dom');
var elButton;
var button;
// data-f1 defines an association with states
// which are later defined when creating an f1 instance
document.body.innerHTML =
'<div data-f1="elButton">' +
'<div data-f1="text">Im a button</div>' +
'</div>';
@mikkoh
mikkoh / index.js
Last active December 1, 2015 01:27
requirebin sketch
var f1DOM = require('f1-dom');
var elButton;
var button;
// data-f1 defines an association with states
// which are later defined when creating an f1 instance
document.body.innerHTML =
'<div data-f1="elButton">' +
'<div data-f1="text">Im a button</div>' +
'</div>';
@mikkoh
mikkoh / index.js
Last active November 27, 2015 17:32
requirebin sketch
var style = require('dom-css');
var NUM_SAMPLES = 100;
var bezier = require('bezier');
var CURVE = [.62,.12,0,1.4];
var x = [ 0, CURVE[0], CURVE[2], 1 ]
var y = [ 0, CURVE[1], CURVE[3], 1 ]
for(var i = 0; i <= NUM_SAMPLES; i++) {
@mikkoh
mikkoh / index.js
Last active November 27, 2015 17:09
requirebin sketch
var style = require('dom-css');
var NUM_SAMPLES = 100;
var CURVE = [0,1.45,1,-1];
for(var i = 0; i <= NUM_SAMPLES; i++) {
var el = document.createElement('div');
style(el, {
width: 10,
@mikkoh
mikkoh / gist:f8752d979f904d9c8690
Created June 5, 2015 16:02
Working with colors
var red = 0xFF; // 255
var green = 0x10; // 16
var blue = 0xCC; // 204
var alpha = 0xFF;
// 24 bit color (no alpha)
var color24 = red << 16 | green << 8 | blue;
// 32 bit color (alpha)
// note >>> 0 if this isn't done alpha overflows to negation bit
@mikkoh
mikkoh / gist:f8c5148871bb3ba57455
Created June 4, 2015 14:28
Converting between TypedArrays
/**
* To convert between typed arrays an ArrayBuffer can be used to create
* TypedArray's from one type to another. Each typed array has a property
* which is an ArrayBuffer.
**/
var uint16 = new Uint16Array([0x0102, 0x0304]);
var uint32 = new Uint32Array(uint16.buffer);
var uint8clamped = new Uint8ClampedArray(uint16.buffer);
var uint8 = new Uint8Array(uint16.buffer);