Skip to content

Instantly share code, notes, and snippets.

View vlucas's full-sized avatar

Vance Lucas vlucas

View GitHub Profile
@vlucas
vlucas / freshbooks_invoice_hours_by_person.js
Last active December 20, 2015 07:18
JavaScript bookmarklet to total everyone's hours on a Freshbooks invoice
/**
* Loop over all invoice line items and total up hours/quantity for each person
* @author Vance Lucas, Brightbit, LLC
*/
var people = {};
$('table.invbody-items tr').each(function(index) {
var tr = $(this);
var personParts = tr.find('div.description').text().match(/.*\]([^\:]*):/);
if(personParts) {
var person = personParts[1];
@vlucas
vlucas / gist:6003622
Created July 15, 2013 21:21
Process for running migrations on a Heroku Rails app

Assumtions: Git repo cloned from remote named "production" (hence the "-r production" flags)

Pane 1:

heroku logs -t -r production

Pane 2:

Getting Started with Titanium (Redux)

Now that Titanium is starting to have a proper CLI, installing and using Titanium is 67% more awesome. At some of the CLI commands, you will be asked for config information and your Appcelerator login, but these are the high level steps:

  1. Sign up for an account at appcelerator.com
  2. Install node.js
  3. Install Xcode from the Mac App Store
  4. sudo npm install -g titanium
  5. titanium sdk install --default
  6. titanium create
@vlucas
vlucas / gist:3976934
Created October 29, 2012 22:22 — forked from ericboehs/gist:3863345
PHP / MySQL Server (Ubuntu 12.04)
#!/usr/bin/env bash
###
# Run this script as root
###
# Setup variables for this script
USER_NAME=vlucas
USER_EMAIL=vance@vancelucas.com
SSH_PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxoQkUlUr+GcEpY1Its3mXFq/xi6yUgknxcSfGx0Yl25zo9nLl5UpeA+r0SmTfnu5oj674i+Ccx7NgwIkhGONXyKZaWyQf7jQZRa6sAMyETQ8QFbkprLCcF6LXJ9B1Khj16ZgXgcuSjMQKmbi8FA3iCcP5jGeT/02x5QhC5hXNPZafODwR5Xty559mLqsZ3LwzQZ4YaQDi4fnEDz7z4iA5+2Xo44de4ypmAmRBsOJZ0mgiRyClDEa0TVCctIXLeOt5OU76DE/IXuKHmtpwWiAI+c6ZNLmXeidrMQzhS6XfDwtTS0YMNnXn4aSSSJNhuvRAhCj9qjAXT1lV1QPb2P84Q== vance@vancelucas.com"
@vlucas
vlucas / budgets.json
Created June 18, 2012 21:33
Hypermedia API with "form"-like descriptions
{
"_links":{
"add":{
"title":"Add Budget",
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets",
"method":"post",
"parameters":{
"name":{
"type":"string",
"required":true
{
"page":1,
"actions":{
"add":{
"url":"http://localhost:3000/events.json",
"method":"post",
"fields":{
"category_id":{
"type":"integer",
"length":null,
frisby.create('Ensure each tweet has base attributes')
.get('https://api.twitter.com/1/statuses/user_timeline.json?screen_name=brightbit')
.expectStatus(200)
.expectHeaderContains('content-type', 'application/json')
.expectJSONTypes('*', {
id_str: String,
retweeted: Boolean,
in_reply_to_screen_name: function(val) { expect(val).toBeTypeOrNull(String); }, // Custom matcher callback
user: {
verified: Boolean,
get('http://api.joind.in/v2.1/events/907')
expectJSONTypes({
name: String
start_date: String
end_date: String
description: String
href: String
attendee_count: Number
icon: String
tags: Array
@vlucas
vlucas / hack.sh
Created April 2, 2012 16:50 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@vlucas
vlucas / gist:1802688
Created February 11, 2012 17:22
Mac OS X Architecture Flags
# x386 Architecture
export CFLAGS="-arch i386 $CFLAGS"
export CCFLAGS="-arch i386 $CCFLAGS"
export CXXFLAGS="-arch i386 $CXXFLAGS"
export LDFLAGS="-arch i386 $LDFLAGS"
# x64 Architecture
export CFLAGS="-arch x86_64 $CFLAGS"
export CCFLAGS="-arch x86_64 $CCFLAGS"
export CXXFLAGS="-arch x86_64 $CXXFLAGS"