Skip to content

Instantly share code, notes, and snippets.

@tonyarnold
tonyarnold / NSUserDefaultsObjectSubscripting.h
Created July 29, 2012 07:51
Add simple object subscripting to NSUserDefaults
//
// NSUserDefaults+ObjectSubscripting.h
//
// Created by Tony Arnold on 29/07/12.
// Copyright (c) 2012 The CocoaBots. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSUserDefaults (ObjectSubscripting)
@rnapier
rnapier / fix-xcode
Last active October 31, 2024 13:54
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
#!/usr/bin/python
# fix-xcode
# Rob Napier <[email protected]>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
@L2G
L2G / .gitconfig
Created September 29, 2012 04:58
A little sugar I add to my user .gitconfig
[url "[email protected]:L2G/"]
insteadOf = "github:///L2G/"
insteadOf = "http://github.com/L2G/"
insteadOf = "https://github.com/L2G/"
[url "https://github.com/"]
insteadOf = "github:///"
insteadOf = "http://github.com/"
@adgedenkers
adgedenkers / vpn_connection.scpt
Created October 11, 2012 18:16
Toggle Connection to VPN on a Mac via AppleScript
tell application "System Events"
-- get current clipboard contents as a string
set CurrentClipboard to the clipboard as string
-- set the clipboad to your password
set the clipboard to "Y0urVPNPa$$w0rd"
-- start playing with the VPN
tell current location of network preferences
@subdigital
subdigital / test.rb
Created October 22, 2012 13:05
Running objective-c tests from the command line (with color)
# based on https://gist.github.com/3349345
# Thanks, @alloy!
#
# To get your project ready for this, you'll have to create a scheme for your unit test project, make sure run is checked in
# the build step, and then delete the Test Host setting.
# Also, make sure you have the colored and open4 gems installed.
require 'rubygems'
require 'colored'
require 'pathname'
@hvolkmer
hvolkmer / gist:4020468
Created November 5, 2012 21:32 — forked from aderyabin/gist:1465125
AppleScript to migrate from Things to Omnifocus
--------------------------------------------------
--------------------------------------------------
-- Import tasks from Things to OmniFocus
--------------------------------------------------
--------------------------------------------------
--
-- Script taken from: http://forums.omnigroup.com/showthread.php?t=14846&page=2
--
-- Added: creation date, due date, start date functionality
@d-amend
d-amend / gist:4206103
Created December 4, 2012 16:51
Selecting UITableViewCells in grouped UITableViews with custom color or view
#import <QuartzCore/QuartzCore.h>
@implementation CustomTableViewController
-(void)setSelectionViewForCell:(UITableViewCell*)cell withRoundedRectCorners:(UIRectCorner)rectCorners
{
CGRect cellRect = CGRectMake(0, 0, cell.bounds.size.width-18, cell.bounds.size.height);
UIView *view = [[UIView alloc] initWithFrame:cellRect];
if (rectCorners != 0) { //we need rounded corners, beginning or end of a tableViewSection
@twobitlabs
twobitlabs / gist:4226365
Created December 6, 2012 17:35
Blocks cheat sheet
// http://cocoawithlove.com/2009/10/ugly-side-of-blocks-explicit.html has a nice breakdown of the syntax--it helps to think of the ^ as similar to a pointer dereference symbol *
// block typedef:
typedef void(^Block)();
typedef void(^ConditionalBlock)(BOOL);
typedef NSString*(^BlockThatReturnsString)();
typedef NSString*(^ConditionalBlockThatReturnsString)(BOOL);
// block property with typedef:
@kvnsmth
kvnsmth / example-subtree-usage.md
Last active March 24, 2025 17:21
A real world usage for git subtrees.

Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?

With submodules

Add the project to your repo:

git submodule add [email protected]:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@subdigital
subdigital / install_provisioning_profile.sh
Created February 27, 2013 17:10
Script to install provisioning profiles on a build server
#! /bin/sh
# Takes a provisioning profile and installs it into the system path.
# This requires poking inside the provisioning profile and searching for the
# UUID present at the end of the file.
set -e
if [[ -z "$1" ]]
then