Skip to content

Instantly share code, notes, and snippets.

View tylerthebuildor's full-sized avatar
💭
Hello World!

Tyler tylerthebuildor

💭
Hello World!
View GitHub Profile
@tylerthebuildor
tylerthebuildor / Enhance.js
Created December 15, 2015 22:44 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@tylerthebuildor
tylerthebuildor / README.md
Created December 6, 2015 20:29 — forked from mbostock/.block
Twitter SVG Logo
@tylerthebuildor
tylerthebuildor / gist:54f439eaf6cd729de62f
Created November 30, 2015 19:41 — forked from lsauer/gist:2907369
Google Chrome special pages for memory, debug, resources, profiling, downloads...

####lsauer.com


###Overview of all chrome:// pages.

  • List by calling chrome://about/
  • Following is a direct dump from the 'about' page for reference

###List of Pages as per v20.xxx

/** The de-facto unbiased shuffle algorithm is the Fisher-Yates (aka Knuth) Shuffle.*/
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex ;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.0 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a
// Console arguments testing
var apc = [].slice;
(function(){
console.log( apc.call(arguments) );
})( "false", 1, undefined, null, ["foo","bar","baz"], {a:1,b:2}, false );
(function(){
console.log.call( console, apc.call(arguments) );
@tylerthebuildor
tylerthebuildor / pubsub-simple.js
Last active August 29, 2015 14:27 — forked from fatihacet/pubsub-simple.js
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,
@tylerthebuildor
tylerthebuildor / svg2png.js
Last active August 29, 2015 14:26 — forked from gustavohenke/svg2png.js
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@tylerthebuildor
tylerthebuildor / optimizedScroll.js
Created July 29, 2015 22:39
The JavaScript scroll event isn't very peformant this MDN snippet fixes that with a modified event.
(function() {
'use strict';
var throttle = function(type, name, obj) {
obj = obj || window;
var running = false;
var func = function() {
if (running) { return; }
running = true;
obj.requestAnimationFrame(function() {
obj.dispatchEvent(new CustomEvent(name));