Skip to content

Instantly share code, notes, and snippets.

View burtlo's full-sized avatar

Lynn Frank burtlo

View GitHub Profile
@burtlo
burtlo / recipe.rb
Created April 30, 2012 00:58
Trivial Example of a the Recipe creation
module Measurements
def cup
self * 48
end
alias_method :cups, :cup
def tsp ; self ; end
alias_method :tsps, :tsp
@burtlo
burtlo / .bash_profile
Last active October 3, 2015 18:18
Github pull request from the command-line
function pull-request {
hub pull-request -h $(__github_remote_origin):$(__github_current_branch)
}
function __github_remote_origin {
# Finds the origin on github if it is https or git
echo "$1`git remote -v | grep -e "^origin.* (push)" | sed "s#origin[[:blank:]]https://github.com/\([^/]*\)\/.*#\1#" | sed "s#origin.*:\([^/]*\).*push.*#\1#"`"
}
function __github_current_branch {
@burtlo
burtlo / universal-target.rb
Created March 25, 2012 23:31
Xcoder - Creating a Universal Target
require 'xcoder'
project_name = 'TestProject'
universal_framework_name = 'Library'
# All paths specified are the logical paths within the Xcode Project
source_filenames = [ 'TestProject/AppDelegate.m' ]
public_headerfilenames = [ 'TestProject/AppDelegate.h' ]
project_headerfilenames = [ 'TestProject/Supporting Files/TestProject-Prefix.pch' ]
@burtlo
burtlo / Guardfile
Created March 11, 2012 15:41
HAML with YAML
guard 'shell' do
watch(/(.*).(?:haml|ya?ml)/) do |file|
haml_file = file.first.gsub(/ya?ml/,'haml')
html_file = file.first.gsub(/[yh]a?ml/,'html')
puts "Converting #{haml_file} to #{html_file}"
`haml #{haml_file} > #{html_file} --trace`
end
end
@burtlo
burtlo / Rakefile
Created March 1, 2012 20:52
Initial Xcode Project Rakefile
require 'tmpdir'
CONFIGURATION = "Debug"
SIMULATOR_DIR = File.expand_path('~/Library/Application Support/iPhone Simulator/5.0')
BUILD_DIR = File.join(File.dirname(__FILE__), "build")
XCODEBUILD_BIN = 'xcodebuild'
SDK_DIR = "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"
def output_file(target)
Dir.mkdir(BUILD_DIR) unless File.exists?(BUILD_DIR)
@burtlo
burtlo / Gemfile
Created February 3, 2012 19:17
Test Flight Rake Task
source "http://rubygems.org"
gem "rake"
gem "highline"
#
# XCoder
#
gem "xcoder", :git => "git://github.com/burtlo/xcoder.git", :ref => "e4f2b627f33f39fabc3ec4aa4e05e3dbfc60450e"
gem "xcoder-cedar", :git => "git://github.com/burtlo/xcoder-cedar.git"

Xcode Code Snippets

Installation

cd ~/Library/Developer/Xcode/UserData/CodeSnippets/
git init
git remote add burtlo [email protected]:burtlo/xcode-snippets.git
git pull burtlo master
@burtlo
burtlo / uicolor+hex.h
Created November 30, 2011 00:04
UIColor Category to give it the ability to be created from a hex color as a NSString
#import "UIColor+Hex.h"
#import <UIKit/UIKit.h>
@interface UIColor (HexSupport)
// Provide the ability to generate UIColor from a Hex string value
+ (id)colorWithHex:(NSString *)hex;
@end
@burtlo
burtlo / bundle.bash
Created November 14, 2011 06:16
Bundle
# Bundle
# - Install and run bundle even if it is not installed
function bundle {
if type -P bundle > /dev/null
then
"$(type -P bundle)"
else
gem install bundler && bundle
fi
@burtlo
burtlo / superhero.rb
Created October 26, 2011 03:31
Superheroes In a Dish
Superhero = Struct.new :name, :origin, :nemesis, :nick_name
SUPERHEROES = [
Superhero.new("Batman", "Gotham City", "Joker", "Caped Crusader"),
Superhero.new("Robin", "Gotham City", "Joker", "Boy Wonder"),
Superhero.new("Superman", "Krypton", "Lex Luthor", "Kal El"),
Superhero.new("Supergirl", "Krypton", "Bizzaro", "Kara Zor-El") ]
def find_superheroes_with_nemesis(nemesis)