Skip to content

Instantly share code, notes, and snippets.

View calvinfo's full-sized avatar

Calvin French-Owen calvinfo

View GitHub Profile

Keybase proof

I hereby claim:

  • I am calvinfo on github.
  • I am calvinfo (https://keybase.io/calvinfo) on keybase.
  • I have a public key whose fingerprint is 0A81 BA81 8FB2 8378 7D2E 806F D87F AA5B CC07 5B3D

To claim this, I am signing this object:

/**
* Required Variables.
*/
variable "name" {}
variable "port" {}
variable "elb_security_group" {}
variable "elb_subnets" {}
/**
* Load balancer.
*/
resource "aws_elb" "main" {
name = "${var.name}"
internal = true
cross_zone_load_balancing = true
/**
* Set up our uncaught exception handler
**/
process.on('uncaughtException', function(err){
log.critical('uncaught', err);
setTimeout(function(){
// cleanup...
}, 1000);
});

Keybase proof

I hereby claim:

  • I am calvinfo on github.
  • I am calvinfo (https://keybase.io/calvinfo) on keybase.
  • I have a public key whose fingerprint is A454 9029 F458 3705 25AC 9309 592B 56C5 AC5D 12A0

To claim this, I am signing this object:

@calvinfo
calvinfo / streams.js
Created September 12, 2013 03:22
Streams continue running
var fs = require('fs')
, stream = require('stream');
function Through () {
this.processed = 0;
}
Through.prototype = new stream.Transform();
function End () {}
@calvinfo
calvinfo / composite.js
Created July 23, 2013 19:04
Helenus Composite Keys
var columnName = ['prefix', 'suffix']
, value = 'val'
, timestamp = new Date()
, column = new helenus.Column(columName, value, timestamp);
cf.insert(rowKey, column, options, callback);
@calvinfo
calvinfo / queue.js
Created May 7, 2013 19:51
Multiple queue
function subscribe(queue) {
logger.info('API logger queue created.');
queue.bind('ingestion', '#');
var options = { ack : true, prefetchCount : 1000 };
queue.subscribe(options, function (payload, headers, deliveryInfo, message) {
importer.log(payload, function (err) {
try {
if (err) message.reject(true); // requeue the message
analytics.ready(function() {
if ($("#mixpanel_distinct_id").length > 0) {
var interval = setInterval(function () {
if (window.mixpanel.get_distinct_id) {
$("#mixpanel_distinct_id").val(window.mixpanel.get_distinct_id());
clearInterval(interval);
}
}, 300);
}
});
@calvinfo
calvinfo / session.js
Last active December 14, 2015 12:38
Once per session tracking
(function () {
var traits = analytics.user.traits()
, session = traits.session
, now = +(new Date); // shim for Date.now in older browsers
if (!session || (now - session) > 60*60*1000) {
// Track things which happen once a session
analytics.track('Once a session');