Skip to content

Instantly share code, notes, and snippets.

Step 1:
git clone https://github.com/hyperoslo/pod-template.git MyPod; cd MyPod; ./init.rb
Step 2:
pod name > MyPod
#!/bin/sh
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
}
function has_compatibility() {
@3lvis
3lvis / gist:649a005fb39b0c51c49c
Last active August 29, 2015 14:16
Add support for the latest Xcode to Alcatraz

Find the plugin in ~Library/Application Support/Developer/Shared/Xcode/Plug-ins Open the contents of the plugin Open the Info.plist in Xcode Expand the DVTPlugInCompatibilityUUIDs array Create a new entry and paste in A16FF353-8441-459E-A50C-B071F53F51B7

def should_crop(lines)
(0..6).each do |n|
return false unless lines[n].start_with? "//"
end
return false unless lines[7] = ""
true
end
all_objc = Dir.glob("Classes/**/**/**/**.{m,h}")
all_objc.each do |path|
@3lvis
3lvis / CrazyLazyLoading.m
Created November 13, 2014 12:26
Crazy Lazy Loading
- (HYPLoginViewController *)loginViewController
{
return _loginViewController = (_loginViewController) ?: [HYPLoginViewController new];
}
@3lvis
3lvis / update_build_number.sh
Created October 30, 2014 09:53
Update build number
branch=$(git rev-parse --abbrev-ref HEAD)
buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2013 Peter Steinberger. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
@3lvis
3lvis / gist:a5c718bf4855343b899a
Last active August 29, 2015 14:00
Returns an array or dictionary from a .json file
+ (id)JSONObjectWithContentsOfFile:(NSString*)fileName
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:[fileName stringByDeletingPathExtension]
ofType:[fileName pathExtension]];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSError *error = nil;
id result = [NSJSONSerialization JSONObjectWithData:data
@3lvis
3lvis / keymap.cson
Last active November 8, 2020 11:18
Xcode keymap for Atom
# Your keymap
#
'body':
'ctrl-tab': 'pane:show-next-item'
'alt-cmd-up': 'pane:split-up'
'alt-cmd-down': 'pane:split-down'
'shift-cmd-L': 'application:open-dev'
'shift-cmd-0': 'window:reset-font-size'
'.platform-darwin':
#!/usr/bin/env bash
function openWorkspaceOrProjectWithApp()
{
if [[ -z "$1" || "$#" -ne 2 ]]; then
echo -e "Nothing found\n"
return
fi
IDEFileName=${2##*/}