Skip to content

Instantly share code, notes, and snippets.

@jk
jk / nsdate-helper.podspec
Created July 3, 2012 14:58
NSDate+Helper podspec
Pod::Spec.new do |s|
s.name = 'NSDate+Helper'
s.version = '0.0.1'
s.summary = 'A category to extend Cocoa\'s NSDate class with some convenience functions.'
s.description = 'This is a category for the NSDate class that provides some convenience methods for working with NSDate objects and displaying formatted and relative strings.'
s.homepage = 'http://www.zetetic.net/blog/'
s.license ='Copyright © 2009, 2010, ZETETIC LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
@jk
jk / XCDFakeCarrier.m
Created July 3, 2012 13:05 — forked from 0xced/XCDFakeCarrier.m
Hack to choose the displayed carrier name in the iOS simulator
//
// Copyright (c) 2012 Cédric Luthi / @0xced. All rights reserved.
//
#if TARGET_IPHONE_SIMULATOR
static NSString * const FakeCarrier = @"AT&T";
#import <objc/runtime.h>
@jk
jk / User-Preferences.sublime-settings.json
Created June 28, 2012 12:27
Sublime Text 2 User Settings
{
// Filename: Prefereces.sublime-settings in Packages/User/
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font face": "Inconsolata-dz",
"font_size": 14.0,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
@jk
jk / generate_passkit_manifest.sh
Created June 28, 2012 09:27
Generate PassKit manifest.json
echo "{"`find . -type f -exec shasum {} + | sed 's/\.\///g' | awk '{print "\t\"" $2 "\" : \"" $1 "\","}' | grep -v -E "(\.DS_Store|manifest\.json)"`"}" | sed 's/\,}/}/g' | python -mjson.tool > manifest.json
@jk
jk / NSLogger-CocoaLumberjack-connector.podspec
Last active October 6, 2015 08:38
NSLogger-CocoaLumberjack-connector
Pod::Spec.new do |s|
s.name = 'NSLogger-CocoaLumberjack-connector'
s.version = '1.2.cp1'
s.license = 'BSD'
s.summary = 'Bridges NSLogger and CocoaLumberjack.'
s.homepage = 'https://github.com/steipete/NSLogger-CocoaLumberjack-connector'
s.author = { 'Peter Steinberger' => 'steipete@gmail.com' }
s.source = { :git => 'https://github.com/jk/NSLogger-CocoaLumberjack-connector.git', :commit => 'a05e5c51fad2c850c44eab6643f131f48a38929c' }
s.description = 'This is a bridge for the projects http://github.com/robbiehanson/CocoaLumberjack (A general purpose super-fast logging framework) and http://github.com/fpillet/NSLogger (send logs to a client app via network).'
s.source_files = 'DDNSLoggerLogger.*'
@jk
jk / Default (OSX).sublime-keymap
Created June 14, 2012 08:57
Sublime Text 2 - User defined shortcuts
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" },
{ "keys": ["alt+up"], "command": "inc_dec_value", "args": { "action": "inc_min" } },
{ "keys": ["alt+down"], "command": "inc_dec_value", "args": { "action": "dec_min" } },
{ "keys": ["super+up"], "command": "inc_dec_value", "args": { "action": "inc_max" } },
{ "keys": ["super+down"], "command": "inc_dec_value", "args": { "action": "dec_max" } },
@jk
jk / fading_gradient.m
Created May 4, 2012 11:44
UIScrollView fading gradient
- (void)maskUIViewHorizontally:(UIView *)view {
view.layer.mask = nil;
_maskLayer = nil;
if (!_maskLayer) {
_maskLayer = [CAGradientLayer layer];
UIColor *outerColor = [UIColor colorWithWhite:1.0 alpha:0.0]; // transparent
UIColor *innerColor = [UIColor colorWithWhite:1.0 alpha:1.0]; // opaque
@jk
jk / crashQueue.m
Created January 10, 2012 10:27
ARC GCD Crash
-(void)crashQueue {
dispatch_queue_t webviewQueue = dispatch_queue_create("de.company.myCrashQueue", DISPATCH_QUEUE_SERIAL);
_webviewQueueValid = YES;
// NSLog(self.company);
dispatch_async(webviewQueue, ^{
if (_webviewQueueValid) {
NSURL *companyURL = [NSURL URLWithString:[companyURI stringByAppendingFormat:@"%@.html", self.company.pathName]];
NSMutableURLRequest *requestCompany = [NSMutableURLRequest requestWithURL:companyURL];
[self.companyWebView loadRequest:requestCompany];
@jk
jk / objc_api_visibility.pl
Created December 26, 2011 17:26
iOS AppStore private API usage checker
#!/usr/bin/env perl
# objc_api_visibility.pl
# by Ryan Petrich, inspired by Dustin Howett's Logos
# Reads all Objective-C method names from an installed SDK, determines their visibility and optionally compares against an iOS app binary
sub read_methods {
my $cmd = shift;
my $when_found = shift;
my $current_class;
open(LS_CMD, "$cmd |") or die "Can't run '$cmd'\n$!\n";
@jk
jk / ch_returncode.h
Created December 16, 2011 09:22
Completion handler return code snippet
enum ClassNameResult {
ClassNameResultAborted,
ClassNameResultSuccessful,
ClassNameResult…
};
typedef enum ClassNameResult ClassNameResult;