Skip to content

Instantly share code, notes, and snippets.

View Machx's full-sized avatar

Colin Wheeler Machx

View GitHub Profile
@schacon
schacon / .gitconfig
Created April 11, 2011 21:43
insteadOf example
[url "https://github.com/"]
insteadOf = "gh:"
@incanus
incanus / gist:926686
Created April 19, 2011 02:21
live move of UIPopoverController
// check that popover won't try to move off-screen; dismiss if so
//
CGFloat pX = newAttachPoint.x;
CGFloat pY = newAttachPoint.y;
CGFloat pWidth = balloon.popoverContentSize.width;
CGFloat pHeight = balloon.popoverContentSize.height;
CGFloat mWidth = map.bounds.size.width;
CGFloat mHeight = map.bounds.size.height;
UIPopoverArrowDirection d = balloon.popoverArrowDirection;
@ngabel
ngabel / ABOUT
Created May 3, 2011 19:28
A custom class that lets you use property accessor syntax to set/get member vars. (Works very much like NSManagedObject)
If you use this code it would be great to receive a credit and link back in your app! Thanks.
-Niels Gabel
PlacePop Inc
http://placepop.com
http://nielsbot.com
@drewmccormack
drewmccormack / prefixer.py
Created May 10, 2011 07:25
Change the prefix of a Cocoa project
#!/usr/bin/env python
#---------
# Script to change the prefix of a framework
#---------
import os
import re
import string
@perlmunger
perlmunger / DropdownButton.h
Created July 7, 2011 22:00
DropdownButton
@interface DropdownButton : UIControl {
}
@property (nonatomic, assign) CAGradientLayer *gradientLayer;
@property (nonatomic, assign) CAGradientLayer *dropdownLayer;
@property (nonatomic, assign) CAShapeLayer *triangleLayer;
@property (nonatomic, retain) UILabel *label;
#!/bin/bash
#
# Throw this in your crontab.
#
# https://twitter.com/#!/manton/status/111893189971017729
#
BOSS=boss@example.org
CPU_THRESHOLD=1500
@iamleeg
iamleeg / main.mm
Created March 24, 2012 00:23
Using operator overloading with Objective-C. Erm, ++.
#include "objc_id.hpp"
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSString *s1 = @"hello";
NSString *s2 = [@"hell" stringByAppendingString: @"o"];
if ((objc_id(s1) == objc_id(s2))) {
NSLog(@"win");
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@markd2
markd2 / bool.m
Created May 7, 2012 19:14
Playing with different scenarios with Objective-C's BOOL type
#import <Foundation/Foundation.h>
// clang -g -Wall -framework Foundation -o bool bool.m
// Are these two integers different? YES if so, NO if not
// (even though it says YES and NO, it LIES! Can actualy return a range
// of non-YES values)
static BOOL different (int thing1, int thing2) {
@jbroadway
jbroadway / Slimdown.md
Last active February 3, 2026 22:10
Slimdown - A simple regex-based Markdown parser.