Skip to content

Instantly share code, notes, and snippets.

These constants are used to choose the version of OpenGL ES that a rendering context provides.
typedef NSUInteger EAGLRenderingAPI;
enum
{
kEAGLRenderingAPIOpenGLES1 = 1
kEAGLRenderingAPIOpenGLES2 = 2
};
static Singleton *singleton = nil;
+ (Singleton *) sharedService {
@synchronized(self) {
if (singleton == nil) {
[[self alloc] init]; // assignment not done here
}
}
return singleton;
}
function parse_git_branch {
[ -d .git ] || return 1
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="*"
fi
# add an else if or two here if you want to get more specific
[UIView beginAnimations:@"FlipToBackView" context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:pageAndBackView cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(flipToBackViewDidStop:finished:context:)];
pageView.hidden = YES;
backView.hidden = NO;
[UIView commitAnimations];
>>> td = 1224831600.0
>>> tm = 1224918000.0
>>> cal = calendar.open()
>>> e = cal.find_instances(td, tm)
>>> e
[{'id': 99, 'datetime': 1224774000.0}]
# datetime is less than td which is the start time
NSASCIIStringEncoding = 1,
NSNEXTSTEPStringEncoding = 2,
NSJapaneseEUCStringEncoding = 3,
NSUTF8StringEncoding = 4,
NSISOLatin1StringEncoding = 5,
NSSymbolStringEncoding = 6,
NSNonLossyASCIIStringEncoding = 7,
NSShiftJISStringEncoding = 8,
NSISOLatin2StringEncoding = 9,
NSUnicodeStringEncoding = 10,
>> h = {}
=> {}
>> h.class
=> NSMutableDictionary
>> h.setObject 'foo', forKey:42
=> nil
>> h
=> {42=>"foo"}
>> h.description
=> "{\n 42 = foo;\n}"
CGSize size = CGSizeMake(90.0, 90.0);
CGRect rect = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGFloat radius = 5.0;
CGFloat minx = CGRectGetMinX(rect), midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect);
CGFloat miny = CGRectGetMinY(rect), midy = CGRectGetMidY(rect), maxy = CGRectGetMaxY(rect);
// Rounded rect path
CGMutablePathRef path = CGPathCreateMutable();
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
// only forward the event UP the responder chain if this touch
// is for a scroll view (self or a subview that inherits from
// UIScrollView); the default UIScrollView implementation deals
// with subview event handling above in the [super] invocation.
UITouch *touch = [touches anyObject];
if ([touch.view isKindOfClass:[UIScrollView class]]) {
// stuff here
10/11/08 3:35:46 PM | Oct11 GitX[6822] Error loading /Library/InputManagers/GrowlSafari/GrowlSafariLoader.bundle/Contents/MacOS/GrowlSafariLoader: dlopen(/Library/InputManagers/GrowlSafari/GrowlSafariLoader.bundle/Contents/MacOS/GrowlSafariLoader, 265): no suitable image found. Did find:
/Library/InputManagers/GrowlSafari/GrowlSafariLoader.bundle/Contents/MacOS/GrowlSafariLoader: GC capability mismatch
10/11/08 3:35:46 PM | Oct11 GitX[6822] Error loading /Library/InputManagers/Inquisitor/Inquisitor.bundle/Contents/MacOS/Inquisitor: dlopen(/Library/InputManagers/Inquisitor/Inquisitor.bundle/Contents/MacOS/Inquisitor, 265): no suitable image found. Did find:
/Library/InputManagers/Inquisitor/Inquisitor.bundle/Contents/MacOS/Inquisitor: GC capability mismatch
10/11/08 3:35:46 PM | Oct11 GitX[6822] Error loading /Library/InputManagers/Safari AdBlock/Safari AdBlock.bundle/Contents/MacOS/Safari AdBlock: dlopen(/Library/InputManagers/Safari AdBlock/Safari AdBlock.bundle/Contents/MacOS/Safari AdBlock, 26