Skip to content

Instantly share code, notes, and snippets.

@wonga00
wonga00 / README.md
Last active November 5, 2019 00:11
In radius search with d3.quadtree
@wonga00
wonga00 / gist:70c6f246b3bd483ee110634cd67f78f3
Created September 24, 2017 17:46
Making parts from score pdfs
Extract jpgs from pdf with ImageMagick
>> convert -density 250 -trim score.pdf -quality 100 score.jpg
Open all jpgs into preview
Open Sketch
Go through every page in preview and copy regions and paste them into the sketch. They should all appear at the same resolution.
Make a rectangle that is like a 8.5 x 11 paper as a template and arrange the cutouts on the page.
@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')
@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 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 / 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 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 / 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 / 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 / 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