Skip to content

Instantly share code, notes, and snippets.

@dnprock
dnprock / README.md
Created August 27, 2013 23:40 — forked from mbostock/.block

A box-and-whisker plot uses simple glyphs that summarize a quantitative distribution with five standard statistics: the smallest value, lower quartile, median, upper quartile, and largest value. This summary approach allows the viewer to easily recognize differences between distributions. Data from the Michelson–Morley experiment. Implementation contributed by Jason Davies. This example periodically randomizes the values to demonstrate transitions.

@dnprock
dnprock / client_config.js
Created September 24, 2013 18:53
Different configs for meteor dev/staging/production environments.
getS3Bucket = function() {
var host = document.location.host;
if (host === 'localhost:3000') {
return 'myapp-dev';
} else if (host === 'myapp.meteor.com') {
return 'myapp-staging';
} else if (host === 'myapp.com') {
return 'myapp-production';
}
}
@dnprock
dnprock / client_example.html
Created September 24, 2013 18:58
Meteor image file upload. Then send file to S3.
Template.example.events({
'change input': function(ev) {
_.each(ev.srcElement.files, function(file) {
Meteor.saveFile(file, file.name);
});
}
});
@dnprock
dnprock / extract_users.js
Last active December 24, 2015 16:39
Export meteor mongodb users to CSV format. Useful for email marketing.
// # get mongo temp URL
// meteor mongo --url my_app
// # dump data from mongo
// mongodump -u client -h [production_url_with_port] -d my_app -p [password_hash]
// # run your mongo server
// mongod --dbpath ./my_app_data
// # restore data
// mongorestore --db dump/my_app
// # export data to CSV
// mongo my_app extract_users.js
@dnprock
dnprock / vida_d3.js
Created October 23, 2013 23:37
vida.io script attach to d3 components, call vida_d3.attach and detach.
var orig_appendChild = Element.prototype.appendChild;
var inspect_rect = null;
vida_d3 = {
getCallStack: function() {
var fn = arguments.callee;
var callstack = []
while ( (fn = fn.caller) ) {
callstack.push(fn.toString())
}
@dnprock
dnprock / README.md
Last active August 29, 2015 14:00
seattle 2012

Seattle Temperature.

@dnprock
dnprock / nginx.conf
Last active June 25, 2019 18:19
meteor nginx load balance with sticky session, used by vida.io
# Sticky session module for nginx
# https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/
# nginx configure command: ./configure --with-http_ssl_module --add-module=../nginx-sticky-module-ng/ --sbin-path=/usr/local/sbin --with-http_gzip_static_module
upstream vida_node_server {
sticky path=/;
server 127.0.0.1:3000 max_fails=3 fail_timeout=30s;
server [server2]:3000 max_fails=3 fail_timeout=30s;
}
@dnprock
dnprock / force.csv
Last active August 29, 2015 14:01 — forked from d3noob/.block
source target value
Harry Sally 1.2
Harry Mario 1.3
Sarah Alice 0.2
Eveie Alice 0.5
Peter Alice 1.6
Mario Alice 0.4
James Alice 0.6
Harry Carol 0.7
Harry Nicky 0.8
.line {
fill: none;
stroke: #4682b4;
stroke-width: 1.5px;
}
.area {
fill: #EDE624;
}
@dnprock
dnprock / README.md
Last active September 10, 2015 22:51 — forked from mbostock/.block

From Wikipedia:

Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Use the menu in the top-left to change the frame of reference, fixing the specified gear in-place.