Skip to content

Instantly share code, notes, and snippets.

View burtlo's full-sized avatar

Lynn Frank burtlo

View GitHub Profile
@burtlo
burtlo / example_spec.rb
Created October 19, 2011 02:29
Basic Example
describe "Failed Spec" do
it "fails" do
fail
end
end
first_array = [ 2, 1, 3]
second_array = first_array
second_array.sort!
puts first_array # [ 1, 2, 3 ]
@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)
@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 / 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

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 / 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"
@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 / 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 / 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' ]