Skip to content

Instantly share code, notes, and snippets.

@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 / README.md
Last active August 29, 2015 14:00
seattle 2012

Seattle Temperature.

@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 / 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 / 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 / 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 / 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.