Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
# !/bin/bash | |
# Copyright (c) 2011 Float Mobile Learning | |
# http://www.floatlearning.com/ | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the "Software"), | |
# to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the |
#define DATA(str) [(NSString*)(str) dataUsingEncoding:NSUTF8StringEncoding] | |
- (NSData *)generateFormData:(NSDictionary *)dictionary boundary:(NSString *)boundary { | |
NSMutableData *data = [[NSMutableData alloc] init]; | |
id key; | |
NSEnumerator *enumerator = [dictionary keyEnumerator]; | |
while (key = [enumerator nextObject]) { | |
id value = [dictionary valueForKey:key]; | |
[data appendData:DATA(([NSString stringWithFormat:@"--%@\r\n", boundary]))]; |
configuration = ENV["CONFIGURATION"] | |
project_dir = ENV["PROJECT_DIR"] | |
settings_bundle = "#{project_dir}/Resources/Settings.bundle" | |
plist_location = "#{project_dir}/Resources/SettingPlists" | |
release_or_debug = ENV["CONFIGURATION"] == "Debug" ? "Debug" : "Release" | |
settings_plist = "#{plist_location}/SettingsRoot#{release_or_debug}.plist" | |
system("cp #{settings_plist} #{settings_bundle}/Root.plist"); | |
system("touch #{settings_bundle}/Root.plist"); |
NSFont *normalFont = [NSFont systemFontOfSize:12]; | |
CGRect renderFrame = CGRectMake(0, 0, 300, 50); // box to render the text into | |
static NSLayoutManager *layMan = nil; | |
if (!layMan) { | |
layMan = [NSLayoutManager new]; | |
} | |
CGFloat lineHeight = [layMan defaultLineHeightForFont:normalFont]; // calculate the expected height of a line | |
NSDictionary *attrDict = [NSDictionary dictionaryWithObject:normalFont andKey:NSFontAttributeName]; |
delimiter // | |
DROP FUNCTION calc_distance; | |
CREATE FUNCTION calc_distance (lat1 double, lon1 double, lat2 double, lon2 double) RETURNS double | |
RETURN (ACOS(SIN(lat1 * PI() / 180) * SIN(lat2 * PI() / 180) + COS(lat1 * PI() / 180) * COS(lat2 * PI() / 180) * COS((lon1 - lon2) * PI() / 180)) * 180 / PI()) * 111189.57696; | |
// | |
delimiter ; |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
#import <Foundation/Foundation.h> | |
@interface BNRDiggyDict : NSObject | |
// React to object indexing. Would be nice to have a @protocol for this | |
- (id) objectForKeyedSubscript: (id) key; | |
- (void) setObject: (id) thing forKeyedSubscript: (id<NSCopying>) key; | |
// And for fun, it also can react to scalar indexing. | |
// Returns the N'th key of the top-level collection. |
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
#!/bin/sh | |
# 2012 - Ben Clayton (benvium). Calvium Ltd | |
# Found at https://gist.github.com/2568707 | |
# | |
# This script installs a .mobileprovision file without using Xcode. Unlike Xcode, it'll | |
# work over SSH. | |
# | |
# Requires Mac OS X (I'm using 10.7 and Xcode 4.3.2) | |
# |