Skip to content

Instantly share code, notes, and snippets.

View kevinmcmahon's full-sized avatar

Kevin McMahon kevinmcmahon

View GitHub Profile
@jverkoey
jverkoey / shouldAutorotate_nonintrusive.m
Last active August 29, 2015 13:57
Implementing UINavigationController/UITabBarController support for shouldAutorotate without subclassing or extending.
// Add this to your app delegate.
// Neither `UINavigationController` nor `UITabBarController` have the slightest decency to ask their
// visible view controller whether IT would like to rotate and just go on and do whatever the hell
// they please. This'll show 'em.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
UIViewController* topViewController = window.rootViewController;
do {
// Navigate modal controllers.
@JLamkin
JLamkin / boost.sh
Last active August 29, 2015 14:01 — forked from rsobik/boost.sh
Updated to fix issue with building for x86_64 architecture and targeting iOS.
#===============================================================================
# Filename: boost.sh
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
#===============================================================================
#
# Builds a Boost framework for the iPhone.
# Creates a set of universal libraries that can be used on an iPhone and in the
# iPhone simulator. Then creates a pseudo-framework to make using boost in Xcode
@cocoahero
cocoahero / README.md
Created July 12, 2012 17:05
Android Auto-Versioning w/ Git

It is common practice to make the android:versionCode in the AndroidManifest.xml the build number of the application. An easy build number to calculate is the number of git commits in the repo.

Instead of having to edit the manifest file manually and update the android:versionCode attribute with the build number, below is a git pre-commit hook that does it for you.

#!/usr/bin/env bash

MANIFEST="AndroidManifest.xml"

if [ -f $MANIFEST ]
@Nitewriter
Nitewriter / hockeyapp_upload.sh
Last active November 13, 2015 16:41
HockeyApp Upload Script
#!/bin/bash
# Markdown change log for the last 20 commits
CHANGE_LOG=$(git log --pretty=format:"* %s" --no-merges --no-color -n 20)
echo CHANGE_LOG
curl \
-F "status=2" \
-F "notify=1" \
-F "notes=$CHANGE_LOG" \
@cliss
cliss / NSArray+CLinq.h
Last active December 11, 2015 00:39
NSArray category that extends it with abilities inspired by Microsoft LINQ. See Readme.md below. Update 13/1/13: Heavily modified as per @jamiepinkham's recommendations. Thanks!
//
// NSArray+CLinq.h
//
// Created by Casey Liss on 12/1/13.
// Copyright (c) 2013 Casey Liss. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef id(^CLSelector)(id source);
@mattt
mattt / nshipster-new-years-2015.md
Created November 25, 2014 19:38
NSHipster New Year's 2015

Season's Greetings, NSHipsters!

As the year winds down, and we take a moment to reflect on our experiences over the past months, one thing is clear: 2014 has been an incredible year professionally for Apple developers. So much has happened in such a short timespan, and yet it's hard to remember our relationship to Objective-C before Swift, or what APIs could have captivated our imagination as much as iOS 8 or WatchKit.

It's an NSHipster tradition to ask you, dear readers, to send in your favorite tips and tricks from the past year for publication over the New Year's holiday. This year, with the deluge of new developments—both from Cupertino and the community at large—there should be no shortage of interesting tidbits to share.

Submit your favorite piece of Swift or Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

If you're wondering about what to post, look to

// gem install cocoapods-playgrounds
// pod playgrounds LibYAML
// Update: @floriankugler had a great idea to use UnsafeBufferPointer
// Paste in the following:
import LibYAML
public struct YAMLError: ErrorType {
func submit() {
guard let name = nameField.text else {
show("No name to submit")
return
}
guard let address = addressField.text else {
show("No address to submit")
return
}
@prabirshrestha
prabirshrestha / HttpClient.java
Last active October 10, 2018 16:06
OkHttpClient+RxJava
package com.example.rx_okhttp;
import com.squareup.okhttp.OkHttpClient;
import org.apache.http.*;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicHttpResponse;
import rx.Observable;
import rx.Observer;
import rx.Scheduler;
source ~/.bash_profile
cd ${SRCROOT}
/path/to/xctool.sh -reporter json-compilation-database:compile_commands.json clean
/path/to/xctool.sh -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'