Skip to content

Instantly share code, notes, and snippets.

View potch's full-sized avatar

Potch potch

View GitHub Profile
var searchForm = $('#search-form'),
searchEl = $('#search'),
nav = $('#tabs'),
fields = 'id,assigned_to,priority,summary,status,last_change_time,whiteboard',
fieldsPretty = {
'assigned_to': 'assigned to',
'last_change_time': 'changed'
},
sortField = localStorage['sort-field'] || 'last_change_time',
sortDirection = localStorage['sort-direction'] === 'true',
var searchForm = $('#search-form'),
searchEl = $('#search'),
nav = $('#tabs'),
fields = 'id,assigned_to,priority,summary,status,last_change_time,whiteboard',
fieldsPretty = {
'assigned_to': 'assigned to',
'last_change_time': 'changed'
},
sortField = localStorage['sort-field'] || 'last_change_time',
sortDirection = localStorage['sort-direction'] === 'true',
@potch
potch / getb2g.sh
Created October 30, 2012 22:21
On a Mac? use this script to update your B2G Desktop!
#!/bin/bash
# Which version should we fetch?
b2gremote="https://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/"
appname="B2G"
if [ "$1" == "aurora" ]; then
b2gremote="https://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-aurora/"
appname="B2GAurora"
fi
@potch
potch / manny.js
Created November 8, 2012 19:42
Simple HTML5 Offline Cache introspection lib.
if ('applicationCache' in window) {
function Log(el) {
function ts() {
var d = (new Date());
function p(v, n) {
return ('00' + d['get'+v]()).substr(-n);
}
return [p('Hours',2), p('Minutes',2),
p('Seconds',2), p('Milliseconds',3)].join(':');
}
@potch
potch / webapps-unplugged.md
Created November 16, 2012 18:45
Draft of a blog post on offline.

Webapps Unplugged

"We're building the phone powered by the Open Web!"

"If you can build a website, you can build an app"

"Great, but what if you don't have an internet connection?"

Well, um…

@potch
potch / tinyAMD.js
Last active February 11, 2024 22:34
Proposal shim for a Minimal AMD system
// # tinyAMD: a Minimal AMD shim.
// I define Minimal AMD as the following:
// * Every define() call provides a module id field (no filename magic)
// * No additional network traffic to fetch modules
// * All dependencies must be defined before a module may be required
// ## Uses
// * small-footprint production shim for use with an r.js optimized project
// * If you write modules in Minimal AMD coding style, you can use tinyAMD
@potch
potch / README.md
Last active June 6, 2022 10:54
Path data generation helper for SVG <path> elements

SVG path data generator

This is excerpted from my work on emilio.js, a d3 plotting library, but useful enough to stand on its own.

  • Generators are constructed with new Path().
  • Takes two optional arguments, xScale and yScale.
    • Methods for coordinate space translation.
    • Works great with d3.scale() objects!
    • xScale and yScale affect the x and y coordinate spaces, respectively.
  • If only xScale is supplied, y values will be in the xScale space.
@potch
potch / keyboard.html
Last active December 11, 2015 08:48
html for a simple musical keyboard
<style>
#keyboard {
height: 300px;
}
.key {
float: left;
height: 320px;
width: 100px;
border: 1px solid black;
display: block;
<title>picoedit</title><pre id='c' contenteditable></pre><script>var p=document.getElementById('c'),d=window.location.hash.substr(1)||'a',l=localStorage;p.innerHTML=l[d]||'> ';setInterval(function(){l[d]=p.innerHTML;},1000);</script>
@potch
potch / urlparse.js
Created February 1, 2013 22:57
Hey everyone we solved URL parsing in JavaScript!
var urlparse = (function() {
var a = document.createElement('a');
// urlparse('https://example.com:8080/bar.html?baz#yay')
return function(url) {
a.href = url;
return {
hash: a.hash, // '#yay'
host: a.host, // 'example.com:8080'
hostname: a.hostname, // 'example.com'