Skip to content

Instantly share code, notes, and snippets.

View jrallison's full-sized avatar

John Allison jrallison

View GitHub Profile
@jrallison
jrallison / b.go
Created March 15, 2015 19:46
Version b
package main
import (
"customerio/core/customers"
"customerio/core/segments"
"customerio/core/spaces"
"flag"
"log"
"strconv"
"time"
@jrallison
jrallison / a.go
Created March 15, 2015 19:45
Version A
package main
import (
"customerio/core/customers"
"customerio/core/segments"
"customerio/core/spaces"
"flag"
"log"
"strconv"
"time"
@jrallison
jrallison / keybase.md
Created March 6, 2014 20:21
keybase.md

Keybase proof

I hereby claim:

  • I am jrallison on github.
  • I am jrallison (https://keybase.io/jrallison) on keybase.
  • I have a public key whose fingerprint is EB89 AFFA 56B8 C4AC 2700 E487 2626 D32F C175 D7F5

To claim this, I am signing this object:

id planlimit actual percentage
8 1000 444937 4449370.0
326 50000 6898878 1379775.6
157 1000 104069 1040690.0
716 1000 81610 816100.0
6 5000 366381 732762.0
944 1000 52382 523820.0
190 1000 48945 489450.0
122 1000 38109 381090.0
18 1000 30379 303790.0
@jrallison
jrallison / gist:5815086
Created June 19, 2013 15:11
QUnit loader HTML and CSS
<body>
<div id="results"></div>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="ember-testing-container"><div id="application"></div></div>
<style>
#results {
font-family: Courier New;
font-size: 12px;
@jrallison
jrallison / gist:5779381
Created June 14, 2013 04:05
Ember with fixtures
App = Em.Application.create
LOG_TRANSITIONS: true
rootElement: "#application"
App.Store = DS.Store.extend
revision: 12,
# Specifying the fixture adapter rather than RESTAdapter, etc
adapter: DS.FixtureAdapter.create()
App.Campaign = DS.Model.extend
@jrallison
jrallison / application_controller.rb
Created May 22, 2012 14:58
Force timeout before the unicorn worker gets reaped
class ApplicationController < ActionController::Base
around_filter :force_timeout
protected
def force_timeout(&block)
begin
# Make sure the timeout here is less than
# the timeout configured for unicorn reaping.
# Here we set a timeout of 10 seconds and
@jrallison
jrallison / customerio_client.rb
Created May 1, 2012 19:59
Simple Customer.io API client in Ruby using HTTParty.
# Simple Customer.io API client in Ruby (1.9 syntax) using HTTParty.
# Uses https://github.com/jnunemaker/httparty for all the heavy lifting.
#
# Usage:
#
# client = Customerio.new("YOUR SITE ID", "YOUR API SECRET KEY")
#
# # Identifying a user with user attributes
# user.email = "user@example.com"
# client.identify(user, { first_name: "Bob", plan: "basic" })
@jrallison
jrallison / gist:1483238
Created December 15, 2011 22:31
Admin assistant and Rails 3.0.10 issue.
diff --git a/Gemfile b/Gemfile
index 861f72a..e63813d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,7 +5,8 @@ gem 'rails', '3.0.10'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
-gem 'sqlite3'
+gem 'mysql'
@jrallison
jrallison / gist:1370496
Created November 16, 2011 16:11
results

EXPLAIN

mysql> explain SELECT * FROM `submissions` WHERE `submissions`.`id` = 5334;
+----+-------------+-------------+-------+---------------+---------+---------+-------+------+-------+
| id | select_type | table       | type  | possible_keys | key     | key_len | ref   | rows | Extra |
+----+-------------+-------------+-------+---------------+---------+---------+-------+------+-------+
|  1 | SIMPLE      | submissions | const | PRIMARY       | PRIMARY | 4       | const |    1 |       | 
+----+-------------+-------------+-------+---------------+---------+---------+-------+------+-------+

1 row in set (0.01 sec)