Skip to content

Instantly share code, notes, and snippets.

Ortwin Gentz, FutureTap futuretap

Block or report user

Report or block futuretap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@futuretap
futuretap / NSDate+Additions.m
Created Mar 22, 2018
relative time formatter
View NSDate+Additions.m
- (NSString*)localizedRelativeTime {
NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
formatter.allowedUnits = NSCalendarUnitHour | NSCalendarUnitMinute;
formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleShort;
if (self.timeIntervalSinceNow < 60 && self.timeIntervalSinceNow > -60) {
return NSLocalizedString(@"right now", @"from MapKit/Maps");
} else if (self.timeIntervalSinceNow > 0) {
NSString *start = [formatter stringFromDate:NSDate.date toDate:self];
return [NSString stringWithFormat:NSLocalizedString(@"in %@", @"placeholder: minutes/hours"), start];
} else {
@futuretap
futuretap / UIResponder+FTAdditions.h
Created Sep 14, 2016
Block based interface to UIKeyCommand
View UIResponder+FTAdditions.h
//
// UIResponder+FTAdditions.h
// Streets
//
// Created by Ortwin Gentz on 09.05.16.
// Copyright © 2016 FutureTap. All rights reserved.
//
#import <UIKit/UIKit.h>
@futuretap
futuretap / UISegmentedControl+Accessibility.m
Created Oct 27, 2015
Workaround to make UISegmentedControl with images accessible. See http://openradar.appspot.com/radar?id=118413
View UISegmentedControl+Accessibility.m
//
// UISegmentedControl+Accessibility.m
//
// Created by Ortwin Gentz on 30.05.14.
// Copyright (c) 2014 FutureTap. All rights reserved.
//
@implementation UISegmentedControl (Accessibility)
// Use these convenience setters for easy customization in IB using user defined runtime attributes
@futuretap
futuretap / gist:69c6289e791b10b43fba
Created Oct 21, 2014
Download the last 12 months of Financial Reports from iTunes Connect (uses Apples Autoingestion tool)
View gist:69c6289e791b10b43fba
#!/bin/bash
VENDORID=80012345
DATAFOLDER="${HOME}/Sales Reports"
CLASSPATH="${HOME}/bin"
ZVENDORID=`printf %.10d ${VENDORID}`
for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
for REGION in "AE" "AU" "CA" "CH" "CN" "DK" "EU" "GB" "HK" "ID" "IL" "IN" "JP" "MX" "NO" "NZ" "RU" "SA" "SE" "SG" "TR" "TW" "US" "WW" "ZA" ; do
View gist:8019643
Pod::Spec.new do |spec|
spec.name = 'DTCoreText'
spec.version = '1.6.9'
spec.platform = :ios, '4.3'
spec.license = 'BSD'
spec.source = { :git => 'https://github.com/Cocoanetics/DTCoreText.git', :tag => spec.version.to_s }
spec.source_files = 'Core/Source/*.{h,m,c}'
spec.dependency 'DTFoundation/Core', '~>1.6.0'
spec.dependency 'DTFoundation/UIKit', '~>1.6.0'
spec.dependency 'DTFoundation/DTHTMLParser', '~>1.6.0'
View gist:8019473
pod --verbose install
Analyzing dependencies
Updating spec repositories
Updating spec repo `master`
$ /usr/bin/git pull
Already up-to-date.
Resolving dependencies of `Podfile`
@futuretap
futuretap / gist:6920492
Last active Dec 25, 2015
Logs iOS device color and device enclosure color. Attention: private API, do not use in App Store builds!
View gist:6920492
UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString([device.systemVersion hasPrefix:@"7"] ? @"_deviceInfoForKey:" : @"deviceInfoForKey:");
NSLog(@"DeviceColor: %@ DeviceEnclosureColor: %@", [device performSelector:selector withObject:@"DeviceColor"], [device performSelector:selector withObject:@"DeviceEnclosureColor"]);
@futuretap
futuretap / createAllTestLocalizables.php
Created Dec 17, 2012
Script to create a Javascript hash out of all Localizable.strings files. Essential if you're using UIAutomation and want to address buttons etc. by localized title. More info: http://www.innoq.com/blog/phaus/2011/01/using_uiautomation_for_multila.html This is a slightly modified version of the script presented in the blog post that correctly dea…
View createAllTestLocalizables.php
<?php
//please replace with your settings...
$i18n_folder = "Custom/Resources";
$uiAutomationFolder = "Test/UIAutomationTests/lib";
if(substr($i18n_folder, -1) != "/"){
$i18n_folder.="/";
}
$langs = array();
$ihandle = opendir($i18n_folder);
View XPathQuery.m
//
// XPathQuery.m
// FuelFinder
//
// Created by Matt Gallagher on 4/08/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
// Permission is given to use this source code file, free of charge, in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
@futuretap
futuretap / weak linking error
Created Nov 23, 2010
MessageUI framework now linked as "Required", not "Weak". Using LLVM GCC 4.2, BASE SDK iOS 4.2, Deployment target 3.1.
View weak linking error
dyld: Symbol not found: _OBJC_CLASS_$_MFMessageComposeViewController
Referenced from: /var/mobile/Applications/C257779B-F488-4890-A08B-883D2D631258/WhereTo.app/WhereTo
Expected in: /System/Library/Frameworks/MessageUI.framework/MessageUI
in /var/mobile/Applications/C257779B-F488-4890-A08B-883D2D631258/WhereTo.app/WhereTo
You can’t perform that action at this time.