Skip to content

Instantly share code, notes, and snippets.

@wonga00
wonga00 / index.html
Last active August 29, 2015 13:57
Haydn String Quartets
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Haydn String Quartets</title>
<style>
html {
height: 100%;
}
@wonga00
wonga00 / index.html
Created March 10, 2014 05:28
Highlight Selection
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
circle {
fill: #ddd;
}
rect {
fill: none;
@wonga00
wonga00 / smyck_mod.terminal
Created March 19, 2014 20:54
modified smyck mac terminal scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMCAw
IDAAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj
dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa
@wonga00
wonga00 / gist:c71ed72421efd9a3250b
Created March 10, 2015 09:35
Time Series helpers
import pandas as pd
from datetime import datetime, timedelta
from pm_base.util.tz import convert_to_utc, convert_to_localtime
from numpy import ones
from matplotlib.pyplot import xlim, title
def to_ts(values, tz=None):
"""convenience function that can take in a list of times
@wonga00
wonga00 / index.html
Last active November 20, 2015 16:32
Bar charts with patterns
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<div id="chart"></div>
@wonga00
wonga00 / index.html
Last active April 15, 2017 08:30
Chart Slider
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: sans-serif;
}
.slider rect {
fill: gray;
@wonga00
wonga00 / saveTable.js
Created April 16, 2017 18:59
console code to save data out of a html table
function saveToFile(text, filename) {
let hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(text);
hiddenElement.target = '_blank';
hiddenElement.download = filename;
hiddenElement.click();
}
function saveTable(selector, filename) {
@wonga00
wonga00 / index.html
Last active September 1, 2017 04:20
gradual appear
<script src="https://d3js.org/d3.v4.min.js"></script>
<body>
<canvas width="960" height="500"></canvas>
<script>
let ctx = d3.select('canvas').node().getContext('2d'),
numCol = 150,
numRow = 150,
shuffledIds = d3.shuffle(d3.range(0, numCol * numRow)),
selectedIds = new Set(),
@wonga00
wonga00 / index.html
Last active September 12, 2017 06:12
dithered paths
<script src="https://d3js.org/d3.v4.min.js"></script>
<body>
<canvas width=800 height=600></canvas>
<script>
let canvas = document.querySelector('canvas'),
ctx = canvas.getContext('2d'),
height = 600,
width = 800,
pChangeDirection = 0.9;
@wonga00
wonga00 / index.html
Last active September 15, 2017 05:08
Labeling arcs at the midpoint
<script src="https://d3js.org/d3.v4.min.js"></script>
<body>
<script>
let width = 300;
let height = 300;
let svg = d3.select('body').append('svg')
.attr('width', width)
.attr('height', height)
.append('g')