Skip to content

Instantly share code, notes, and snippets.

View mikkoh's full-sized avatar

Mikko Haapoja mikkoh

View GitHub Profile
@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 / 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 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
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: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>';
fire();
setInterval(fire, 300);
setInterval(unfire, 500);
function fire() {
$('#can').trigger(TRUMP.main.events[0]);
}
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);
}
});