Skip to content

Instantly share code, notes, and snippets.

View OliverLetterer's full-sized avatar
👨‍💻
Happy coding :)

Oliver Letterer OliverLetterer

👨‍💻
Happy coding :)
View GitHub Profile
@OliverLetterer
OliverLetterer / xctest_finder.py
Created December 30, 2015 09:29 — forked from briancroom/xctest_finder.py
Script to assist with conforming to XCTestCaseProvider
#!/usr/bin/python
# Invoke this script with a Swift file containing an XCTestCase and it will
# generate an implementation for the `allTests` variable required for
# XCTestCaseProvider conformance on Linux
import sys
import re
inFile = open(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin
# Install libxml2 using Homebrew
# If you don't have Homebrew, follow the instructions at:
# https://github.com/mxcl/homebrew/wiki/Installation
# -------------------------------------------------------
brew install libxml2
# Install libxslt from source code
# If you don't have wget, follow the instructions at:
# http://www.mactricksandtips.com/2008/07/installing-wget-on-your-mac-for-terminal.html
# Or use Homebrew:
// Created by Nick Snyder on 11/13/12.
// NDCollectionViewFlowLayout.h
@interface NDCollectionViewFlowLayout : UICollectionViewFlowLayout
@end
@OliverLetterer
OliverLetterer / cocoapods.zsh
Last active December 16, 2015 20:49
zsh script for automatically sending pull-request to CocoaPods/Specs:master without push access. make sure you have https://github.com/defunkt/hub installed
user="OliverLetterer"
master="CocoaPods"
pod-lint() {
pod spec lint --local --verbose
}
pod-release() {
git add -A && git commit -m "Release "$1"."
git tag $1
#import <UIKit/UIKit.h>
@interface UIView (SMFrameAdditions)
@property (nonatomic, assign) CGPoint $origin;
@property (nonatomic, assign) CGSize $size;
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect
@end
@OliverLetterer
OliverLetterer / Find files to refactor
Created March 11, 2013 21:05
Find files which are worth to refactor
sloccount --details . | sort -n -k1,1
@interface SomeViewController ()
// Declare some collection properties to hold the various updates we might get from the NSFetchedResultsControllerDelegate
@property (nonatomic, strong) NSMutableIndexSet *deletedSectionIndexes;
@property (nonatomic, strong) NSMutableIndexSet *insertedSectionIndexes;
@property (nonatomic, strong) NSMutableArray *deletedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *insertedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *updatedRowIndexPaths;
@end
desc "Create a new version tag and push a new podspec"
task :release do
require 'cocoapods'
require 'colored'
version = Pod::Specification.from_file(Pathname.pwd + 'MyLib.podspec').version
puts "Releasing version `#{version}'. Is that correct? (y/n)"
if $stdin.gets.strip.downcase == 'y'
sh "git tag -a #{version} -m 'Release #{version}'"
sh "git push --tags"
sh "pod lint"
@OliverLetterer
OliverLetterer / CCamera.m
Created November 28, 2012 08:10
Really simple Objective-C AVFoundation Camera class
//
// CCamera.h
// CCamera
//
// Created by Jonathan Wight on 7/12/12.
// Copyright (c) 2012 Jonathan Wight. All rights reserved.
//
#import <Foundation/Foundation.h>
@OliverLetterer
OliverLetterer / XCDFakeCarrier.m
Created September 28, 2012 07:00 — 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>