Skip to content

Instantly share code, notes, and snippets.

View MidnightDesign's full-sized avatar

Rudolph Gottesheim MidnightDesign

View GitHub Profile
interface CSSStyleDeclaration {
willChange: string;
}
function positionAndDimensionsFromClientRect(element: HTMLElement, sourceClientRect: ClientRect) {
element.style.top = sourceClientRect.top.toString(10) + 'px';
element.style.left = sourceClientRect.left.toString(10) + 'px';
element.style.width = sourceClientRect.width.toString(10) + 'px';
element.style.height = sourceClientRect.height.toString(10) + 'px';
}
@MidnightDesign
MidnightDesign / update-dom.ts
Created February 21, 2017 23:09
Update DOM
function updateElement(target: Element, source: Element): Element {
target = updateTagName(target, source.tagName);
updateAttributes(target, source);
updateChildNodes(target, source);
return target;
}
function updateAttributes(target: Element, source: Element): void {
const sourceAttributes = Array.from(source.attributes);
const targetAttributes = Array.from(target.attributes);
<?php
// https://www.youtube.com/watch?v=zzKGnuvX6IQ
$dice = [
'333333' => [3, 3, 3, 3, 3, 3],
'004444' => [4, 4, 4, 4, 0, 0],
'111555' => [5, 5, 5, 1, 1, 1],
'222266' => [2, 2, 2, 2, 6, 6],
];