Skip to content

Instantly share code, notes, and snippets.

@henrik
henrik / SearchBoxExperimentsViewController.h
Created February 15, 2010 06:55
Replace the magnifying glass icon in an iPhone UISearchBar with a custom image.
#import <UIKit/UIKit.h>
@interface SearchBoxExperimentsViewController : UIViewController {
IBOutlet UISearchBar *searchBar;
}
@end
@DerAndereAndi
DerAndereAndi / Description.md
Last active December 15, 2015 09:19
Ground Control additions, see description.md file below

Ground Control by @mattt is a great iOS library to remotely configure your iOS app by sending plists from a server to your app and then updating the user defaults values.

I wanted to extend this a bit with the following ideas in mind:

  • Define the values in a JSON file, instead of uploading an updated plist file to the server
  • Define values independently for given bundle identifiers, bundle version and language combination, so I can modify e.g. beta and debug versions independently from released apps
  • Values can be defined in a default language for a bundle version and overwritte on language specific entries like en. You can also only use default or only use specific languages
  • Return an empty plist for all unknown bundle identifiers or bundle versions
  • Don't check for config updates on every startup or every time the app becomes active, but only once a day or a remotely configurable amount of days
  • Right now the server side ph
@luisobo
luisobo / README.md
Last active January 14, 2016 14:19
Hide iOS Simulator when running Unit Tests.

Hide iOS Simulator when running Unit Tests.

Based on this work, that @Dan2552 pointed out.

Instructions:

  1. Clone this gist (git clone https://gist.github.com/6201428.git hide_ios_simulator)
  2. Xcode -> Preferences -> Behavior -> Testing -> Generates output
  3. Run script -> Choose script -> Select hide_simulator
@windgazer
windgazer / prepare-commit-msg.sh
Last active January 8, 2019 14:04 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name. TLDR, from the root of each repository you want to use this, install using `curl -L https://goo.gl/5Mmuoi -o .git/hooks/prepare-commit-msg --create-dirs; chmod 744 .git/hooks/prepare-commit-msg`
#!/bin/bash
# To update or install in a new repository, run the following command
# N=.git/hooks/prepare-commit-msg ; curl -L https://goo.gl/5Mmuoi -o $N --create-dirs; chmod 744 $N
# Assuming all branches are created as `WWW-nnn-Human-readable-suffixes`
# this commit-msg hook will prepend all commit messages with the ticket
# name/number, for example:
# Branch: ADV-007-License-to-kill
# Message: Bad guy has been identified.
@steventroughtonsmith
steventroughtonsmith / gist:6763213
Created September 30, 2013 12:39
Non-opaque application windows in iOS 7, with optional blur. Shows the user's wallpaper under the app, with Parallax if supported.
typedef enum _UIBackgroundStyle {
UIBackgroundStyleDefault,
UIBackgroundStyleTransparent,
UIBackgroundStyleLightBlur,
UIBackgroundStyleDarkBlur,
UIBackgroundStyleDarkTranslucent
} UIBackgroundStyle;
@interface UIApplication (UIBackgroundStyle)
-(void)_setBackgroundStyle:(UIBackgroundStyle)style;
@zwaldowski
zwaldowski / NSObject+Blocks.h
Created May 4, 2011 12:08
Perform blocks with delays and cancellation
//
// NSObject+Blocks.h
// Filemator
//
// Created by Zachary Waldowski on 4/12/11.
// Copyright 2011 Dizzy Technology. All rights reserved.
//
@interface NSObject (Blocks)
@0xced
0xced / XCDFakeCarrier.m
Last active March 5, 2023 22:07
Hack to choose the displayed carrier name in the iOS simulator
//
// Copyright (c) 2012-2015 Cédric Luthi / @0xced. All rights reserved.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_SIMULATOR
static const char *fakeCarrier;
static const char *fakeTime;
@adurbalo
adurbalo / Configure rbenv on MacOS.md
Last active October 26, 2023 18:30
Configure rbenv
1. Using ZSH in your Terminal

MacOS Catalina has changed the default terminal from Bash to ZSH. As a result, we'll be adding configs to ~/.zshrc instead of ~/.bash_profile like we used in the past. You can manually change from Bash to ZSH anytime by running the following command:

chsh -s /bin/zsh
2. Install Homebrew

First, we need to install Homebrew. Homebrew allows us to install and compile software packages easily from source. Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes. Open Terminal and run the following command:

@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@joeblau
joeblau / pre-commit
Created June 1, 2019 16:57
Pre commit git hook to run SwiftLint and SwiftFormat
#!/bin/bash
# Place this file in `.git/hooks/`
if which swiftlint >/dev/null; then
swiftlint autocorrect
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
git diff --diff-filter=d --staged --name-only | grep -e '\(.*\).swift$' | while read line; do