Skip to content

Instantly share code, notes, and snippets.

View griffin-stewie's full-sized avatar

griffin-stewie griffin-stewie

View GitHub Profile
@mediabounds
mediabounds / floatsign.sh
Last active March 31, 2024 18:43
A small bash script to re-sign iOS applications.
# !/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
@kishikawakatsumi
kishikawakatsumi / ImageUpload.m
Created November 23, 2011 15:13
Upload image to Twitter with OAuth
#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]))];
@volca
volca / build.rb
Created December 12, 2011 07:59 — forked from daveverwer/build.rb
Ruby script to replace an iOS settings bundle depending on the DEBUG/RELEASE build configuration flag.
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");
@aki-null
aki-null / gist:1497649
Created December 19, 2011 15:23
Core Text APIを使用した際に起こる行間の問題の回避
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];
@masuidrive
masuidrive / calc_distance.sql
Created January 4, 2012 12:03
MySQLで緯度経度 lat/lngから距離をメートルで計算するストアド
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 ;
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@goblindegook
goblindegook / README.md
Created February 26, 2012 22:59 — forked from michaelfox/README.md
Notational Velocity (nvALT) Custom Stylesheet and Markup HTML

Usage

Copy these files to your ~/Library/Application Support/Notational Velocity/ folder.

@markd2
markd2 / BNRDiggyDict.h
Created March 20, 2012 13:45
Objective-C Literals, part 2 support files.
#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.
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
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 {
@benvium
benvium / installMobileProvisionFile.sh
Created May 1, 2012 15:14
This script installs a .mobileprovision file via bash (no GUI session needed)
#!/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)
#