Skip to content

Instantly share code, notes, and snippets.

- (void)dosomething
{
BOOL bacon = YES;
// or...
__block BOOL bacon = YES;
dispatch_block_t block = ^{
// do something with bacon…
//
// UpgradeController.m
// Caffeinated
//
// Created by Curtis Hard on 25/07/2013.
//
//
#import "UpgradeController.h"
NSBitmapImageRep * bitmapRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:rect] autorelease];
CIImage * im = [[[CIImage alloc] initWithBitmapImageRep:bitmapRep] autorelease];
[im drawAtPoint:rect.origin
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0];
// this is the cure to fix the scrollers
- (NSView *)hitTest:(NSPoint)aPoint
{
// CHANGE NEXT LINE TO HOW YOU CHECK FOR LION, UNLESS YOUR APP
// ONLY WORKS ON LION THEN JUST DELETE THE IF
// are we running lion?
if( ! IS_RUNNING_LION )
{
// if we are not, dont bother with the
return [super hitTest:aPoint];
[GGShortcutController observerScheme:SETTING_SHORTCUT_SCHEME
identifier:SETTING_SHORTCUT_TOGGLE_READABILITY
window:[view window]
block:^( GGShortcutContainer * container )
{
[self toggleReadability:nil];
}];
+ (UniChar)characterForVirtualKeyCode:(NSInteger)keyCode
{
/**************
THIS REQUIRES THE CARBON FRAMEWORK!
***************/
UInt32 deadKeyState = 0;
UniCharCount actualCount = 0;
UniChar baseChar;
TISInputSourceRef sourceRef = TISCopyCurrentKeyboardLayoutInputSource();
CFDataRef keyLayoutPtr = (CFDataRef)TISGetInputSourceProperty( sourceRef, kTISPropertyUnicodeKeyLayoutData );
//
// GDataController.m
// Caffeinated
//
// Created by Curtis Hard on 03/11/2010.
// Copyright (c) 2010 GeekyGoodness. All rights reserved.
//
#import "GDataController.h"
$this->set_request( lib_coredata_request::factory( lib_coredata_entity::factory( 'news' ) )
->set_predicate( new lib_coredata_predicate( 'status=%d', 5 ) ) );
<?php
class lib_coredata_predicate extends lib_coredata_properties
{
/**
*
*/
const LIB_COREDATA_FILLER_ATTRIBUTE = '%@';
void NSAnimationContextRunAnimationBlock( dispatch_block_t group, dispatch_block_t completionHandler, NSTimeInterval time )
{
[NSAnimationContext runAnimationBlock:group
completionHandler:completionHandler
duration:time];
}
+ (void)runAnimationBlock:(dispatch_block_t)group
completionHandler:(dispatch_block_t)completionHandler
duration:(NSTimeInterval)time