Skip to content

Instantly share code, notes, and snippets.

View mbinna's full-sized avatar

Manuel Binna mbinna

View GitHub Profile
@mbinna
mbinna / UIViewController+MBSensitiveInformationInScreenshotPrevention.h
Created June 12, 2011 13:00
Prevent sensitive information from appearing in the screenshot that is automatically taken when the application transitions from the foreground to the background and vice-versa.
//
// UIViewController+MBSensitiveInformationInScreenshotPrevention.h
//
// Created by Manuel Binna on 05.05.11.
// Copyright 2011 Manuel Binna. All rights reserved.
//
@interface UIViewController (MBSensitiveInformationInScreenshotPrevention)
@mbinna
mbinna / hack.sh
Created April 11, 2012 05:57 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2357277/hack.sh | sh
#
@mbinna
mbinna / include-version-info.sh
Last active November 12, 2021 20:59
Include Version Info from Git into Info.plist at build time
Add the script include-version-info.sh into a new run script build phase of your application target. The build phase
should be located after the build phase "Copy Bundle Resources".
@mbinna
mbinna / mogenerator.sh
Last active October 13, 2015 03:58
Invoke mogenerator during Xcode build
# The approach used here is adopted from the following source:
# http://nsscreencast.com/episodes/12-importing-into-core-data
#
# Since version 1.27, mogenerator automatically uses the current version of the data model
MODELS_DIR="MyModels"
DATA_MODEL="${MODELS_DIR}/MOPIncrementalStoreModel.xcdatamodeld"
# Homebrew stores mogenerator in /usr/local/bin
PATH=/usr/local/bin:${PATH}
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@mbinna
mbinna / RunUnitTests.sh
Last active October 25, 2017 12:59
Run Xcode Application Tests from the command line
#!/bin/sh
# Launch application using ios-sim and set up environment to inject test bundle into application
# Source: http://stackoverflow.com/a/12682617/504494
if [ "$RUN_APPLICATION_TESTS_WITH_IOS_SIM" = "YES" ]; then
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
environment_args="--setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle=$test_bundle_path --setenv XCInjectBundleInto=$TEST_HOST"
ios-sim launch $(dirname $TEST_HOST) $environment_args --args -SenTest All $test_bundle_path
echo "Finished running tests with ios-sim"
@mbinna
mbinna / appledoc.sh
Created March 29, 2013 18:33
Invoke appledoc in a run script build phase in Xcode
/usr/local/bin/appledoc \
--templates "/usr/local/opt/appledoc/Templates" \
--project-name "${PROJECT_NAME}" \
--project-company "Manuel Binna" \
--company-id "de.binna" \
--output "Documentation" \
--logformat xcode \
.
@mbinna
mbinna / gist:5316890
Created April 5, 2013 05:36
Stub RestKit network requests in Kiwi with Nocilla
#import "MBAEntityFetcher.h"
#import "MBAAPIBaseURL.h"
#import "MBAResponseDescriptorProvider.h"
#import <Kiwi/Kiwi.h>
#import <Nocilla/LSNocilla.h>
#import <RestKit/RestKit.h>
#import <RestKit/Testing.h>
@mbinna
mbinna / isRunningTests.c
Last active December 18, 2015 07:00
Detect if the app was launched in the iOS Simulator to execute the unit tests. Source: http://www.objc.io/issue-1/testing-view-controllers.html
static BOOL isRunningTests(void) {
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
NSString *injectBundle = environment[@"XCInjectBundle"];
return [[injectBundle pathExtension] isEqualToString:@"octest"];
}
@mbinna
mbinna / .clang-format
Created February 18, 2014 12:43
Custom .clang-format
# Reference: http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false