Skip to content

Instantly share code, notes, and snippets.

View potch's full-sized avatar

Potch potch

View GitHub Profile
@potch
potch / proxies_are_magic.html
Created December 9, 2013 22:22
Why can't I have Proxy yet??
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Why can't I have Proxy yet??</title>
</head>
<body>
<div id="item">
<h1 class="name">name goes here</h1>
var dombind = (function() {
function makeSmart(obj) {
obj.__bound__ = {};
}
function isSmart(obj) {
return '__bound__' in obj;
}
@potch
potch / webworkers.js
Created November 18, 2013 21:11
inline Web Workers
function WebWorker (fn) {
var src = '(' + fn.toString() + ')();';
var blob = new Blob([src], { "type" : "text/javascript" });
var url = URL.createObjectURL(blob);
return new Worker(url);
}
var get = WebWorker(function() {
onmessage = function (e) {
var url = e.data;
(function() {
console.log('connecting');
var req = indexedDB.open('asyncStorage', 0);
req.onsuccess = function() {
console.log('connected to asyncStorage')
var db = req.result;
var delReq = db.deleteObjectStore('keyvaluepairs');
delReq.onsuccess = function () {
console.log('success!');
}
var asyncStorage = (function () {
var indexedDB = window.indexedDB ||
window.mozIndexedDB ||
window.webkitIndexedDB ||
window.msIndexedDB;
var storeName = 'asyncStorage';
var db;
@potch
potch / Brick.md
Last active December 27, 2015 10:19

Brick

Brick is a library of re-usable UI components that enables developers to build performant, consistent, quality web application UI. Brick accomplishes this by using Web Components technology to expose components as DOM nodes, for ease of authorship, ambience of API, and interoperability with existing DOM-oriented web frameworks. To accomplish this, Brick will:

  • Curate a list of quality components from a larger Web Components ecosystem to meet common web application authoring needs / UI patterns
  • Author components when they are not more wide available
  • Give them a consistent and simple visual appearance
  • Ensure components are functional on a list of supported web environments
  • Ensure they are performant on a list of supported web environments
  • Offer components individually for advanced users, as well as in bundles through a simple web interface
@potch
potch / README.md
Last active December 25, 2015 05:48 — forked from mbostock/.block

For continuous data such as time series, a streamgraph can be used in place of stacked bars. This example also demonstrates path transitions to interpolate between different layouts. Streamgraph algorithm, colors, and data generation inspired by Byron and Wattenberg.

@potch
potch / style.js
Last active December 24, 2015 10:09
sample style guide code!
var a = 1;
var b = 2;
function repeatString (s, times) {
var returnVal = '';
for (var i = 0; i < times; i++) {
returnVal = returnVal + s;
}
return returnVal;
}
@potch
potch / gistbin.js
Last active December 23, 2015 05:58
Code for Multi-file gist post.
// GistBin 1.0
// By Potch http://potch.me/
// Licensed under BSD.
(function() {
var thisTag = document.getElementsByTagName('script');
thisTag = thisTag[thisTag.length - 1];
var id = thisTag.getAttribute('data-id');
// We kind of need one of these.
if (!id) {
@potch
potch / index.html
Last active December 23, 2015 03:39
Testing multi-file Gist support.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<title>Multifile Gist Test</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>GistBin Demo</h1>