Skip to content

Instantly share code, notes, and snippets.

@Inferis
Inferis / orientation.m
Last active September 19, 2020 21:02
Calculate InterfaceOrientation from a transition coordinator transform
- (UIInterfaceOrientation)orientationByTransforming:(CGAffineTransform)transform fromOrientation:(UIInterfaceOrientation)c
{
CGFloat angle = atan2f(transform.b, transform.a);
NSInteger multiplier = (NSInteger)roundf(angle / M_PI_2);
UIInterfaceOrientation orientation = self.interfaceOrientation;
if (multiplier < 0) {
// clockwise rotation
while (multiplier++ < 0) {
switch (orientation) {
@epatey
epatey / gist:02d8ca2b1e8593a6ce7a
Last active August 29, 2015 14:09
NSObject category that explodes if an object doesn't get deallocated soon
// Use this gist when you need to assert that a particular object is deallocated
// "soon". I use this technique extensively to ensure that I don't introduce retain
// cycles into my code. It really beats not noticing that you regressed and started
// leaking a view controller months ago!
@interface NSObject (ExplodingDealloc)
// Explode if this object isn't deallocated within 3 seconds
- (void)explodeIfNoDealloc;
@Takhion
Takhion / build.gradle
Last active May 28, 2020 11:13 — forked from dmarcato/strip_play_services.gradle
Gradle task to strip unused packages on Google Play Services library, so you don't have to use necessarily Proguard or MultiDex
apply from: 'strip_play_services.gradle'
@davepermen
davepermen / Helpers
Created April 3, 2013 19:46
Static File Content Stuff
public class FileContent
{
NancyConventions conventions;
public FileContent(NancyConventions conventions)
{
this.conventions = conventions;
}
public string this[string requestFile]
@adamgit
adamgit / .gitignore
Last active November 11, 2024 06:14
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#