Skip to content

Instantly share code, notes, and snippets.

View vlucas's full-sized avatar

Vance Lucas vlucas

View GitHub Profile

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: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:

@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 / a-comments.md
Last active May 9, 2017 12:34
Titanium File Upload Differences on Android vs. iPhone

Purpose

The purpose of this gist is to point out that iPhone and Android HTTPClient handle HTTP requests differently when combining file uploads with other form data, for example uploading a photo along with a title or message.

iOS / iPhone

The iOS implementation, as usual, is correct and handles this situation perfectly and as expected.

Android

@vlucas
vlucas / forms.js
Last active December 30, 2015 09:29
// "Constants"
exports.STYLE_HINT = 'hint';
exports.STYLE_LABEL = 'label';
exports.TYPE_DATE = 'date';
exports.TYPE_DATETIME = 'datetime';
exports.TYPE_EMAIL = 'email';
exports.TYPE_URL = 'url';
exports.TYPE_NUMBER = 'number';
exports.TYPE_PASSWORD = 'password';
@vlucas
vlucas / gh_label_setup.sh
Last active February 20, 2017 22:42
Setup New Github Project with System Labels
#!/bin/bash
echo -n "GitHub Repo (e.g. foo/bar): "
read REPO
echo -n "GitHub Access Token: "
read ACCESS_TOKEN
echo ""
@vlucas
vlucas / pre-push.sh
Created July 22, 2014 16:12
Prevent Pushes Directly to Master
#!/bin/bash
# @link https://gist.github.com/mattscilipoti/8424018
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
<?php
// snip ...
// Marketing site routes (www. or no subdomain)
$app->subdomain(['www', false], function($request) use($siteRoutesDir) {
Bullet\View\Template::config(array(
'path' => BULLET_APP_ROOT . '/templates/',
'path_layouts' => BULLET_APP_ROOT . '/templates/layout/site/',
'auto_layout' => 'inner'
));
// PG directly
var pg = require('pg');
var client = new pg.Client(process.env.DATABASE_URL).connect();
// Node-DBI wrapper
var DBWrapper = require('node-dbi').DBWrapper;
var db = new DBWrapper('pg', {dsn: process.env.DATBASE_URL });
db.connect();
@vlucas
vlucas / deploy.sh
Last active February 6, 2024 22:57
Deploy a Static Site to Github Pages
#!/bin/bash
GIT_REPO_URL=$(git config --get remote.origin.url)
mkdir .deploy
cp -R ./* .deploy
cd .deploy
git init .
git remote add github $GIT_REPO_URL
git checkout -b gh-pages
git add .