Skip to content

Instantly share code, notes, and snippets.

@rhysburnie
rhysburnie / prototyping-tools.js
Last active September 18, 2017 02:02
Personal setup Stats, dat.GUI and colors reference for dirty clientside prototyping
/**
* @author Rhys Burnie
* Personal setup for Stats and dat.GUI with a materialColors object for quick nice color options.
* (clientside - dirty) - for things like p5 sketches, codepens etc.
*
* promiseTools().then(function(tools){
* var colors = tools.colors;
* var stats = tools.stats;
* var gui = tools.gui;
*
@rhysburnie
rhysburnie / promise-latency.js
Created September 28, 2016 01:28
Promise Latency
export function promiseLatency(latency = 250) {
return new Promise(resolve => {
setTimeout(resolve, latency);
});
}
@rhysburnie
rhysburnie / floorplan-selector-hooks.css
Last active May 12, 2016 09:41
floorplan svg selector hooks
@custom-selector :--floorplan-level g[data-name*="level"];
@custom-selector :--floorplan-tile g[data-name*="level"] > g;
@custom-selector :--floorplan-bg g[data-name*="level"] > g > g[data-name="bg"];
@custom-selector :--floorplan-lines g[data-name*="level"] > g > g[data-name="lines"];
@custom-selector :--floorplan-labels g[data-name*="level"] > g > g[data-name="labels"];
@custom-selector :--floorplan-labels-text g[data-name*="level"] > g > g[data-name="labels"] text;
@custom-selector :--floorplan-base-bg g[data-name*="level"] > g[data-name*="base"] > g[data-name="bg"];
:root {
--purpleColor: #2B037A;
@rhysburnie
rhysburnie / gist:b4ae154754b03b62a894e4ed1137e52f
Created May 1, 2016 09:18 — forked from knu/gist:111055
How to mass-rename tags and push them with Git
# Rename tags named foo-bar-#.#.# to v#.#.# and push the tag changes
git tag -l | while read t; do n="v${t##*-}"; git tag $n $t; git push --tags ; git tag -d $t; git push origin :refs/tags/$t ; done
@rhysburnie
rhysburnie / _wrap-rule-IE-fixes.scss
Created March 16, 2016 00:36
Wrap sass rule in IE fix selector
@mixin wrap-rules-IE10-plus {
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
& {
@content;
}
}
}
// NB: assumed conditional comment style html element for .ie9 class
// for lower you would need to add more mixins
@rhysburnie
rhysburnie / element-matches-polyfill.js
Last active October 21, 2015 04:15
Polyfill Element.matches
if(typeof window!=="undefined"){
window.Element && function(proto) {
if(!proto.matches) {
proto.matches = proto.matchesSelector ||
proto.mozMatchesSelector ||
proto.msMatchesSelector ||
proto.oMatchesSelector ||
proto.webkitMatchesSelector ||
function (selector) {
var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1;
+function(exports){
// exposed on this global object
var exposed = 'notnative';
/**!
* @author Rhys Burnie
* @description native js coordinates tool for scripts consumption.
* @licence MIT
* Copyright Rhys Burnie
*/
@rhysburnie
rhysburnie / foreach-notnative.js
Last active August 29, 2015 14:21
forEach function for looping results from `querySelectorAll`
/**
* Primarily for looping `querySelectorAll` results (`NodeList`)
*
* Avoid array hacks like: `[].forEach.call(NodeList)`
* see: http://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/
*/
+function(exports){
// exposed on this global object
var exposed = 'notnative';
@rhysburnie
rhysburnie / jquery.tierwatcher.js
Last active August 12, 2016 00:52
Responsive tier change watcher
(function($){
/**
* @author Rhys Burnie
* @license MIT
*
* The MIT License (MIT)
* Copyright (c) 2015 Rhys Burnie
* https://opensource.org/licenses/MIT
*
* Responsive Tier Watcher
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php