Skip to content

Instantly share code, notes, and snippets.

View traviskaufman's full-sized avatar

Travis Kaufman traviskaufman

View GitHub Profile
@traviskaufman
traviskaufman / protobuf_2_6_0_ubuntu_install.sh
Created December 29, 2014 18:33
Shell Script to Compile and Install protobuf v2.6.0 on Ubuntu
# Installs protobuf 2.6.0 on Ubuntu (currently not a deb package ugh)
protodir=protobuf-2.6.0
filename="$(protodir).tar.gz"
known_md5=9959d86087e64524d7f91e7a5a6e4fd7
builddir="$(mktemp -d $TMPDIR/protobuild.XXXXXX)"
if [ ! -d $builddir ]; then
echo "$0: Can't create temp build dir! WTF??!"
exit 1
@traviskaufman
traviskaufman / jasmine-this-vars.md
Last active September 19, 2022 14:35
Better Jasmine Tests With `this`

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {
@traviskaufman
traviskaufman / fe_techinterviewq.md
Last active November 1, 2016 20:09
Comprehensive Front-End Technical Interview Question

###Comprehensive Technical Interview Question

Consider the following javascript module:

/**
 * A module for tracking when a user visits the page.
 */
window.VisitingDateTracker = {
  /**
 * Initialize the tracker.
@traviskaufman
traviskaufman / play_framework_testing_async_responses.md
Last active June 8, 2023 09:09
Testing Asynchronous HTTP Responses in Play Framework

Testing Asynchronous Responses in Play! Framework

TL;DR

The Background

I came across this issue while I was working on a functional test for JAMLive!, a Play! application I'm currently working on obsessing over in my free time. I have a controller with a connect method that looks like this:

@traviskaufman
traviskaufman / cats_vs_dogs.py
Last active December 14, 2015 04:19
My best go at Spotify's Heavy Metal question.
"""
I apologize this isn't more well-documented :/
"""
#!/usr/bin/env python
"""
Plays the game of cat vs. dog
"""
from sys import stdin
@traviskaufman
traviskaufman / ReverseBinary.java
Created February 21, 2013 23:33
My Solution to Spotify's [Reversed Binary Numbers](https://www.spotify.com/us/jobs/tech/reversed-binary/) problem that's apparently wrong for reasons unknown to me. -_-
import java.util.Scanner;
/**
* Class that contains logic to reverse the bits of an integer and spit it
* back out.
*/
public class ReverseBinary {
/**
* Reverse the bits of an integer between 1 ≤ n ≤ 1000000000.