Skip to content

Instantly share code, notes, and snippets.

View odrobnik's full-sized avatar

Oliver Drobnik odrobnik

View GitHub Profile
@odrobnik
odrobnik / log.txt
Created January 23, 2013 15:48
log.txt
commit 82ad4f93ebf956ab4e06a746bb408c536f0544cd
Merge: 85ba3f7 a5d6b82
Author: Oliver Drobnik <[email protected]>
Date: Wed Jan 23 16:10:30 2013 +0100
Merge branch 'master' of github.com:Cocoanetics/DTFoundation
commit a5d6b825e721a2d26dca70eadbffd4659d5fe604
Merge: f43764c c6cdd6e
Author: gugmaster <[email protected]>
@odrobnik
odrobnik / gist:5091275
Created March 5, 2013 15:53
Unable to create an issue with this text:
DTHTMLWriter does not correctly encode emoji unicode sequences.
It outputs this:
Here is a Smiley: &#55357;&#56836; and Mr. Poop: &#55357;&#56489;
which does not display as Emoji in Safari.
NSHTMLWriter does not encode them at all:
@odrobnik
odrobnik / gist:5309752
Created April 4, 2013 11:49
Pictures at URL
- (NSArray *)_picturesInDirectoryAtURL:(NSURL *)URL
{
NSMutableArray *tmpArray = [NSMutableArray array];
NSArray *keys = [NSArray arrayWithObjects:
NSURLIsDirectoryKey, NSURLIsPackageKey, NSURLLocalizedNameKey, nil];
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager]
enumeratorAtURL:URL
includingPropertiesForKeys:keys
@odrobnik
odrobnik / gist:5398597
Created April 16, 2013 18:59
DTLoupe.podspec
Pod::Spec.new do |spec|
spec.name = 'DTLoupe'
spec.version = '1.3.0'
spec.platform = :ios, '4.3'
spec.license = 'COMMERCIAL'
spec.source = { :git => '[email protected]:parts/dtloupe.git', :tag => spec.version.to_s }
spec.source_files = 'Core/Source/*.{h,m}'
spec.frameworks = 'QuartzCore'
spec.requires_arc = true
spec.homepage = 'http://www.cocoanetics.com/parts/dtloupeview/'
@odrobnik
odrobnik / gist:5405993
Created April 17, 2013 17:01
highlight string inside attributed string
- (NSAttributedString *)attributedStringWithString:(NSString *)string highlightedwithOccurencesOfString:(NSString *)stringToHighlight inColor:(DTColor *)color
{
// build an attributed string to start with
// font
DTCoreTextFontDescriptor *fontDesc = [[DTCoreTextFontDescriptor alloc] init];
fontDesc.fontFamily = @"Helvetica";
fontDesc.pointSize = 20;
// paragraph style
@odrobnik
odrobnik / gist:5412380
Created April 18, 2013 12:34
DTLoupe.podspec
Pod::Spec.new do |spec|
spec.name = 'DTLoupe'
spec.version = '1.3.0'
spec.platform = :ios, '4.3'
spec.license = 'COMMERCIAL'
spec.source = { :git => '[email protected]:parts/dtloupe.git', :tag => spec.version.to_s }
spec.source_files = 'Core/Source/*.{h,m}'
spec.frameworks = 'QuartzCore'
spec.requires_arc = true
spec.homepage = 'http://www.cocoanetics.com/parts/dtloupeview/'
- (void)drawInRect:(CGRect)rect context:(CGContextRef)context
{
CGContextDrawImage(context, rect, self.image.CGImage);
}
@odrobnik
odrobnik / WWDC_Sorry.txt
Created April 30, 2013 15:02
WWDC Sorry No Bonus Template
Hello <FIRST_NAME>,
Thank you for contacting us regarding WWDC 2013.
Enthusiasm for this year's conference has been incredible and tickets sold out in record time.
<PERSON> can still take advantage of all the great WWDC content, as we'll be posting videos of all our sessions during the conference.
If you have any further questions please let us know by sending an email to [email protected].
@odrobnik
odrobnik / gist:5590114
Created May 16, 2013 07:53
Weird translation bug in this ...
// get source image
NSData *imageData = _picture.imageData;
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)(imageData), NULL);
CGImageRef sourceImage = CGImageSourceCreateImageAtIndex(source, 0, NULL);
CFRelease(source);
CGRect imageRect = CGRectZero;
imageRect.size.width = CGImageGetWidth(sourceImage);
imageRect.size.height = CGImageGetHeight(sourceImage);
imageRect.origin.x = -imageRect.size.width/2.0;
@odrobnik
odrobnik / gist:5629373
Created May 22, 2013 17:35
DTSQLiteDatabase.h
//
// DTSQLiteDatabase.h
// DTFoundation
//
// Created by Oliver Drobnik on 5/22/13.
// Copyright (c) 2013 Drobnik.com. All rights reserved.
//
/**
A wrapper for SQLite databases which offers threadsafe concurrency and support for cancelling long-running operations.