Skip to content

Instantly share code, notes, and snippets.

Avatar

Calvin French-Owen calvinfo

View GitHub Profile
View keybase.md

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:

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

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 Sep 12, 2013
Streams continue running
View streams.js
var fs = require('fs')
, stream = require('stream');
function Through () {
this.processed = 0;
}
Through.prototype = new stream.Transform();
function End () {}
@calvinfo
calvinfo / composite.js
Created Jul 23, 2013
Helenus Composite Keys
View composite.js
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
Multiple queue
View queue.js
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
View get_distinct_id.js
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 Dec 14, 2015
Once per session tracking
View session.js
(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');
You can’t perform that action at this time.