Skip to content

Instantly share code, notes, and snippets.

View stigi's full-sized avatar
✌️
Casual coding

Ullrich Schäfer stigi

✌️
Casual coding
View GitHub Profile
@stigi
stigi / gist:966511
Created May 11, 2011 14:09
Flipping Coordinates
CGPoint CGPointFlipped(CGPoint point, CGRect bounds) {
return CGPointMake(point.x, CGRectGetMaxY(bounds)-point.y);
}
CGRect CGRectFlipped(CGRect rect, CGRect bounds) {
return CGRectMake(CGRectGetMinX(rect),
CGRectGetMaxY(bounds)-CGRectGetMaxY(rect),
CGRectGetWidth(rect),
CGRectGetHeight(rect));
}
@stigi
stigi / gist:1134408
Created August 9, 2011 15:48
NSArray map reduce
typedef id(^mapFunction)(id obj);
typedef id(^reduceFunction)(id obj1, id obj2);
@implementation NSArray (NSArray_MapReduce)
- (id)map:(mapFunction)mapFunction reduce:(reduceFunction)reduceFunction;
{
   dispatch_queue_t reduceQueue = dispatch_queue_create(0, 0);
   dispatch_group_t group = dispatch_group_create();
CVS
.svn
build
.DS_Store
log/*.log
tmp/**/*
config/database.yml
config/amazons3.yml
db/*.sqlite3
db/*.db
- (UIImage *)optimizedWaveformMask;
{
if (optimizedWaveformMask) return optimizedWaveformMask;
UIImage *originalWaveformImage = track.waveformImage;
if (!originalWaveformImage) return nil;
CGRect maskRect = CGRectZero, imageRect = CGRectZero;
maskRect.size = CGSizeMake(CGRectGetWidth(self.bounds) * [self contentScaleFactor],
CGRectGetHeight(self.bounds) * [self contentScaleFactor]);
diff --git a/OHAttributedLabelTest/RootViewController.m b/OHAttributedLabelTest/RootViewController.m
index 13ca5ef..547d928 100644
--- a/OHAttributedLabelTest/RootViewController.m
+++ b/OHAttributedLabelTest/RootViewController.m
@@ -86,6 +86,7 @@
NSString *baseString = [self.wordList objectAtIndex:indexPath.row];
NSMutableAttributedString *attributedString = [NSMutableAttributedString attributedStringWithString:baseString];
+ [(OHAttributedLabel*)[cell viewWithTag:1337] removeAllCustomLinks];
[(OHAttributedLabel*)[cell viewWithTag:1337] setAttributedText:attributedString];
Pod::Spec.new do |s|
s.name = 'Kiwi'
s.version = '1.0.0'
s.summary = 'A Behavior Driven Development library for iPhone and iPad development.'
s.homepage = 'http://kiwi-lib.info'
s.authors = { 'Allen Ding' => 'allen@allending.com', 'Luke Redpath' => 'luke@lukeredpath.co.uk' }
s.source = { :git => 'https://github.com/allending/Kiwi.git', :tag => 'v1.0.0' }
s.source_files = 'Kiwi'
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"$(SDKROOT)/Developer/Library/Frameworks"',
'OTHER_LDFLAGS' => '-ObjC -all_load -framework SenTestingKit' }
NSArray *windowList = (NSArray *)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenAboveWindow, (CGWindowID)maView.window.windowNumber);
BOOL isHidden = windowList.count > 0;
@stigi
stigi / ideviceinstaller.rb
Created January 3, 2012 14:17
ideviceinstaller brew formula
require 'formula'
class Ideviceinstaller < Formula
url 'http://cgit.sukimashita.com/ideviceinstaller.git/snapshot/ideviceinstaller-1.0.0.tar.gz'
homepage 'http://www.sukimashita.com/'
md5 '011ab522a1dbd262e37500bdb0ff7df0'
depends_on 'pkg-config' => :build
depends_on 'libimobiledevice'
depends_on 'glib'
@stigi
stigi / gist:2422071
Created April 19, 2012 16:18
Function scope using Objective-C blocks
// is there a way to do this with inlining "bla" ?
typedef void(^bla)(void);
bla (^finish)(NSString *) = ^(NSString *what) {
return ^{
NSLog(@"Say %@", what);
};
};
🐱ullrich:~/ $ gem install ocrunner [12:25:14]
Fetching: trollop-1.16.2.gem (100%)
Fetching: fssm-0.2.9.gem (100%)
Fetching: oniguruma-1.1.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing ocrunner:
ERROR: Failed to build gem native extension.
/Users/ullrich/.rbenv/versions/1.9.3-p125/bin/ruby extconf.rb
checking for main() in -lonig... yes