Skip to content

Instantly share code, notes, and snippets.

@hjeffrey
hjeffrey / NSObject+ARCZombie.m
Created August 28, 2012 02:45 — forked from 0xced/NSObject+ARCZombie.m
Solves the problem of .cxx_destruct methods not being called when zombies are enabled
#import <objc/runtime.h>
@implementation NSObject (ARCZombie)
+ (void) load
{
const char *NSZombieEnabled = getenv("NSZombieEnabled");
if (NSZombieEnabled && tolower(NSZombieEnabled[0]) == 'y')
{
Method dealloc = class_getInstanceMethod(self, @selector(dealloc));
@hjeffrey
hjeffrey / UIImage+Retina4.h
Created September 15, 2012 07:44 — forked from bstahlhood/UIImage+Retina4.h
Swizzled UIImage imageNamed for iPhone 5
//
// UIImage+Retina4.h
// StunOMatic
//
// Created by Benjamin Stahlhood on 9/12/12.
// Copyright (c) 2012 DS Media Labs. All rights reserved.
//
#import <UIKit/UIKit.h>
GIT_VERSION=`git --version | awk '{print $3}'`
URL="https://raw.github.com/git/git/v$GIT_VERSION/contrib/completion/git-completion.bash"
PROFILE="$HOME/.profile"
echo "Downloading git-completion for git version: $GIT_VERSION..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi
@hjeffrey
hjeffrey / charles-profile-ios.sh
Last active December 22, 2015 15:28 — forked from evanlong/.profile-ios.sh
sh charles-profile-ios.sh
#/sh/bin
install() {
if [ -f "$SQLITEDBPATH" ]; then
cp -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup"
sqlite3 "$SQLITEDBPATH" <<EOF
INSERT INTO "tsettings" VALUES(X'189B6E28D1635F3A8325E1E002180DBA2C02C241',X'3123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E6731243022060355040B0C1B687474703A2F2F636861726C657370726F78792E636F6D2F73736C3111300F060355040A0C08584B3732204C74643111300F06035504070C084175636B6C616E643111300F06035504080C084175636B6C616E64310B3009060355040613024E5A',X'3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E0A3C21444F435459504520706C697374205055424C494320222D2F2F4170706C652F2F44544420504C49535420312E302F2F454E222022687474703A2F2F7777772E6170706C652E636F6D2F445444732F50726F70657274794C6973742D312E302E647464223E0A3C706C6973742076657273696F6E3D22312E30223E0A3C61727261792F3E0A3C2F706C6973743E0A',X'3082045E30820346A003020102020101300D06092A864886F70D01010505003081913123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E6731243022
@hjeffrey
hjeffrey / iOS symbolicatecrash.sh
Last active August 29, 2015 14:02
解析iOS设备的crash文件
#
# create by Jia Yuhui. at 2014-06-05
# version 1.0
#
# find /Applications/Xcode.app -name symbolicatecrash -type f
## /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash
# export DEVELOPER_DIR="/Applications/XCode.app/Contents/Developer"
# ./$symbolicatecrash xxx.crash xxxxx.dSYM > xxxxxxx.crash
#!/bin/bash
: << '#__REM__'
指定さたライブラリをiOS用にフルオートで作成します。ダウンロード、複数のアーキテクチャのビルドも自動的に行います。デフォルトではi386、x86_64、armv7、armv7s、arm64のアーキテクチャを作成します。
Create a full-auto to iOS for the library specified. I do also builds the architecture download, more than one. Create architecture i386, x86_64, armv7, armv7s, arm64 by default.
#__REM__
TARGET_VERSION="1.3.1"
@hjeffrey
hjeffrey / distributeApp.sh
Last active September 23, 2015 10:11
Automatic make ipa after XCode build. and upload it to ftp, then send a email.
#!/bin/sh
# distributeApp.sh
#
# Created by Jia Yuhui on 29/06/2015.
# Copyright 2015 Jia Yuhui. All rights reserved.
# chmod 755 distributeApp.sh
if [[ ${PLATFORM_NAME} == "iphonesimulator" ]]; then
@hjeffrey
hjeffrey / Info.plist
Created July 9, 2015 13:12
Download ipa for service
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@hjeffrey
hjeffrey / build.sh
Created July 20, 2015 14:09
make ipa by command line tool.
#!/bin/sh
# build.sh
#
# Created by Jia Yuhui on 24/06/2015.
# Modified by Jia Yuhui on 17/07/2015. Fixed Uploading file tyep error and crasylytics error.
# Copyright 2015 Jia Yuhui. All rights reserved.
env=$1
sleepsecond=0
@hjeffrey
hjeffrey / resign.sh
Created July 20, 2015 14:11
Resign ipa.
#!/bin/sh
#
# resign.sh
#
# Created by Jia Yuhui on 08/07/2015.
# Copyright 2015 Jia Yuhui. All rights reserved.
currentPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CERTIFICATE="iPhone Developer: xxx (xxxxxxxx)" # must be in keychain