Skip to content

Instantly share code, notes, and snippets.

@campo
campo / keybase.md
Created December 3, 2015 06:06
keybase.md

Keybase proof

I hereby claim:

  • I am campo on github.
  • I am campo (https://keybase.io/campo) on keybase.
  • I have a public key whose fingerprint is 267C 5FA9 2F1D F488 BC95 A347 F82C 7200 340C 695F

To claim this, I am signing this object:

@campo
campo / capybara cheat sheet.md
Last active August 29, 2015 14:23
Capybara Cheat Sheet
@campo
campo / Preferences.sublime-settings
Last active August 29, 2015 14:05
Sublime User Settings
{
"font_face": "Inconsolata",
"font_size": 22,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
// Disables horizontal scrolling if enabled.
// May be set to true, false, or "auto", where it will be disabled for
// source code, and otherwise enabled.
@campo
campo / marathon.rb
Created April 5, 2013 05:19
A prototype of a solution to answer the following question on StackOverflow: http://stackoverflow.com/questions/15825827/detecting-top-movers-over-a-period-of-time
# This methodology breaks down to the following steps:
# * Determine initial times for all runners
# * Calculate average run times for all runners over the given time period (6 months)
# * Compare each runner's average performance to their initial performance
# * Sort all runners by the improvement of their average performance compared to their initial performance
# This is code I used to generate hashes of race data
#
@campo
campo / campo.plugin.zsh
Created February 1, 2013 23:38
this should go in .oh-my-zsh/custom/plugins/campo/campo.plugin.zsh
mh() { cd ~/Projects/mightyhive/$1; }
_mh() { _files -W ~/Projects/mightyhive/ -/; }
compdef _mh mh
@campo
campo / campo.zsh-theme
Created February 1, 2013 23:36
basic zsh theme, intended to be used with solarized .terminal file for mac os x
PROMPT='%3~$(git_prompt_info) > '
ZSH_THEME_GIT_PROMPT_PREFIX="["
ZSH_THEME_GIT_PROMPT_SUFFIX="]"
@campo
campo / gist:3913815
Created October 18, 2012 18:07
SQL vs. Mongo
17,1,"Jalisco Margarita",NULL,"monte alban tequila, fresh sweet chili pepper, lime juice, agave syrup","8.00","beverage","cocktail","Cocteles/Bebidas",NULL,"[\"tequila\"]",NULL,0,NULL,NULL,NULL,1,"['Mon', 'Tues', 'Weds', 'Thurs', 'Fri', 'Sat', 'Sun']",NULL,NULL,1,NULL,NULL,NULL
{
"name": "Jalisco Margarita",
"description": "Monte Alban tequila, fresh sweet chili pepper, lime juice, agave syrup",
"price": 8.00,
"ingredients": ["tequila", "lime juice"],
"category": "beverage",
"subcategory": "cocktail",
@campo
campo / gist:3909770
Created October 18, 2012 03:50
Data Model: SQLAlchemy vs. MongoAlchemy
# SQLAlchemy
class Prereg(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(120))
fav_restaurant = db.Column(db.String(120))
location = db.Column(db.String(120))
reg_date = db.Column(db.DateTime)
def __init__(self, email, fav_restaurant, location, reg_date=None):
self.email = email
@campo
campo / templess swap
Created May 22, 2012 21:57
Templess Swap from Etsy Interview
<?php
// Given two variables with integer values assumed positive, swap the values without using
// a temp variable
function templessSwap($a, $b){
print("Swapping the values without a temp variable...\n");
print("The initial values are:\nA: $a\nB: $b\n");
$a = $a ^ $b;
$b = $a ^ $b;
$a = $a ^ $b;
print("The values after the swap are:\nA: $a\nB: $b\n\n");