Skip to content

Instantly share code, notes, and snippets.

@keighty
keighty / d3 scales
Last active August 29, 2015 13:56
Scaling D3
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
body{margin:0px;}
.axis path,
.axis line {
fill: none;
stroke: black;
@keighty
keighty / d3.csv()
Last active August 29, 2015 13:57
D3: using csv()
<!DOCTYPE html>
<meta charset="utf-8">
<head><style>
body{margin:0px;}
.axis path,
.axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
@keighty
keighty / next() and rollup()
Last active August 29, 2015 13:57
D3 and raw data
<!DOCTYPE html>
<meta charset="utf-8">
<head><style>
body{margin:0px;}
.axis path,
.axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
@keighty
keighty / apples.csv
Last active August 29, 2015 13:57
Using all the D3 tools
Colors X Y Quantity
#9467bd 1 8 91
#1f77b4 9 1 32
#1f77b4 3 1 67
#bcbd22 5 5 63
#9467bd 6 6 57
#2ca02c 5 10 65
#d62728 8 2 36
#9467bd 2 8 82
#bcbd22 4 7 69

tmux shortcuts & cheatsheet

start new with session name:

tmux new -s myname

attach:

tmux attach-session -t myname
@keighty
keighty / app.js
Created October 16, 2016 00:01
Service worker example
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js')
.then(function(reg) {
if(reg.installing) {
console.log('Service worker installing on registration.');
} else if(reg.waiting) {
console.log('Service worker installed on registration.');
} else if(reg.active) {
console.log('Service worker already active on registration.');
@keighty
keighty / events.js
Created October 16, 2016 15:42
Node EventEmitter example
const EventEmitter = require('events').EventEmitter
const fs = require('fs')
const findPattern = (files, regex) => {
const emitter = new EventEmitter()
files.forEach(file => {
fs.readFile(file, 'utf8', (err, content) => {
if (err) return emitter.emit('error', err)
@keighty
keighty / bs-config.js
Created October 21, 2016 19:38
browser-sync project setup for easy local web server
module.exports = {
"files": ["*html","*js","*css"],
"server": true,
"port": 3000,
"https": true,
"routes": {
"/foo": "foo"
}
};
@keighty
keighty / devtools.html
Created October 26, 2016 03:43
Basic project outline for creating a dev-tools extension
<!DOCTYPE html>
<html>
<body>
<script src="devtools.js"></script>
</body>
</html>
package com.keighty;
import java.lang.annotation.Documented;
@Documented
@interface CustomAnnotation {
int id();
String description();
String author() default "[unknown]";
}