Skip to content

Instantly share code, notes, and snippets.

@tonyhschu
tonyhschu / README.md
Last active August 29, 2015 22:06
fresh block

hello markdown

@tonyhschu
tonyhschu / .block
Last active September 17, 2016 18:06
N Dogs Chasing Random Dog
license: mit
@tonyhschu
tonyhschu / ZeroOneToString.js
Created January 29, 2016 03:05
Mapping [0,1] to a hex color.
var c = function(n) {
var string = '';
n = Math.floor(n * Math.pow(256, 3));
for (var i = 5; i >= 0; i--) {
string += (Math.floor(n / Math.pow(16, i)) % 16).toString(16);
}
return '#' + string;
}
@tonyhschu
tonyhschu / README.md
Last active July 23, 2016 12:02
Time Map

Inspired by this time map post I wanted to build a block that shows a bit more of the intuition about how time maps work. This is a very simple timemap built with D3 that visualizes the speed and frequency of keystrokes.

Built with blockbuilder.org

@tonyhschu
tonyhschu / README.md
Last active May 2, 2016 05:12
iris demo

simple csv demo

for the building-blocks intro video

@tonyhschu
tonyhschu / .block
Last active May 20, 2016 02:37
fresh block
height: 3000
scrolling: yes
@tonyhschu
tonyhschu / react-click-outside.js
Created May 12, 2016 22:45
Closing pop-ups by clicking outside in React
// Making a gist, because I know I'm going to have to find this again...
// Of course, this is a terrible hack. I recommend this only to the desperate (and those who don't want to use mixins.)
componentWillReceiveProps(nextProps) {
if (nextProps.isOpen) {
window.addEventListener('mousedown', this.pageClick, false)
} else {
window.removeEventListener('mousedown', this.pageClick, false)
}
}
@tonyhschu
tonyhschu / .block
Last active February 16, 2024 22:44
Small Scroll-linked Animation Demo
scrolling: yes
license: MIT
@tonyhschu
tonyhschu / README.md
Created July 10, 2016 20:22
fresh block
@tonyhschu
tonyhschu / state-positions.json
Last active July 31, 2016 23:55
A JSON key map for producing a grid map, based on the one seen here: http://www.bloomberg.com/graphics/2015-pace-of-social-change/
{
"AK": [0, 0],
"HI": [0, 7],
"WA": [1, 2],
"OR": [1, 3],
"CA": [1, 4],
"ID": [2, 2],
"UT": [2, 3],
"NV": [2, 4],
"AZ": [2, 5],