Skip to content

Instantly share code, notes, and snippets.

@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active January 15, 2023 13:03
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@myell0w
myell0w / KeyboardLayoutGuide.swift
Created July 19, 2017 14:53
A UILayoutGuide that follows the Keyboard on iOS
import Foundation
import UIKit
/// Used to create a layout guide that pins to the top of the keyboard
final class KeyboardLayoutGuide {
private let notificationCenter: NotificationCenter
private let bottomConstraint: NSLayoutConstraint
@antons
antons / xcode-plugin-update.sh
Last active May 4, 2016 20:04
Script to make all your Xcode plugins “compatible” with currently selected version of Xcode.
#!/bin/sh
PLIST_BUDDY=/usr/libexec/PlistBuddy
xcode-plugin-add-compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
}
xcode-plugin-has-compatibility() {
@anagromataf
anagromataf / post-checkout
Created July 11, 2014 12:49
post-checkout-Hook for using Cocoa Pods together with the Xcode CI Server
#!/bin/sh
##
## Create a folder at /var/teamsserver/ and set the user and group to _teamsserver
## Copy this script to /Applications/Xcode.app/Contents/Developer/usr/share/git-core/templates/hooks/post-checkout
##
export LC_ALL="en_US.UTF-8"
export HOME="/var/teamsserver/"
@pwc3
pwc3 / swift-repl
Last active August 29, 2015 14:02
#!/usr/bin/env bash
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
@matthiasplappert
matthiasplappert / uikonf2014-slides.md
Last active November 28, 2018 13:04
UIKonf 2014 Slides
@stigi
stigi / post-merge
Last active August 29, 2015 13:55
A simple git hook that let's you know whenever you need to update your CocoaPods after merging or pulling from a remote.
#!/bin/bash
#
# Let's you know when your pods should be updated right after a git pull or git merge
# Also works for fast-forward pulls.
#
# To enable this hook for your project, save it as .git/hooks/post-merge
diff "Podfile.lock" "Pods/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
@0xc010d
0xc010d / NSString+Mod97Check.h
Last active April 9, 2021 13:57
Objective-C implementation of mod97 IBAN checking algorithm
#import <Foundation/Foundation.h>
@interface NSString (Mod97Check)
- (BOOL)passesMod97Check; // Returns result of mod 97 checking algorithm. Might be used to check IBAN.
// Expects string to contain digits and/or upper-/lowercase letters; space and all the rest symbols are not acceptable.
@end
@tylerhall
tylerhall / SFBestGuess.h
Created September 25, 2011 19:21
By inspecting the user's address book and finding the most common city, state, and zip code - we can make an educated guess as to the user's location without using CoreLocation.
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
@interface SFBestGuess : NSObject {
NSMutableArray *_cities;
NSMutableArray *_states;
NSMutableArray *_zipCodes;
}
@property (nonatomic, retain) NSMutableArray *cities;