Skip to content

Instantly share code, notes, and snippets.

View tokorom's full-sized avatar

tokorom tokorom

View GitHub Profile
@tokorom
tokorom / gist:11341082
Created April 27, 2014 09:05
xcode from cui
#!/bin/sh
if [ $# -lt 1 ]; then
echo "USAGE: xcode_action [action]"
echo "action:"
echo " build"
echo " run"
echo " clean"
echo " open FileName:row"
exit 1
@tokorom
tokorom / gist:11209159
Last active August 29, 2015 14:00
retrive ios keywords
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks
find . -name "*.h" | xargs egrep -o '[-+]\s+\([^/]*;' | egrep -o '[-+]\s+.*' | sort | uniq > method_defines.txt
if [ -e *.xcworkspace ]; then
find *.xcworkspace | head -1 | xargs open
elif [ -e *.xcodeproj ]; then
find *.xcodeproj | head -1 | xargs open
fi
#!/usr/bin/env objc-run
@import Foundation;
//----------------------------------------------------------------------------//
#pragma mark - interface
//----------------------------------------------------------------------------//
@interface Sample : NSObject
xcodebuild: error: Failed to build project ReplaceImageCategoryForXcode with scheme Tests.
Reason: The scheme 'Tests' is not configured for Running.

objc/runtimeの中でも安全度の高いやつを使ってみよう!

ふつうにActionSheetを使うと

UIActionSheet* sheet = [UIActionSheet new];
sheet.delegate = self;
[sheet addButtonWithTitle:@"action1"];
[sheet addButtonWithTitle:@"action2"];
[sheet addButtonWithTitle:@"Cancel"];
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString*)path
zipInfo:(unz_global_info)zipInfo
unzippedPath:(NSString*)unzippedPath
{
NSString* bundlePath = [unzippedPath stringByAppendingPathComponent:@"storyboards.bundle"];
NSURL* url = [NSURL fileURLWithPath:bundlePath];
NSBundle* bundle = [NSBundle bundleWithURL:url];
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Downloadable" bundle:bundle];
UIViewController* viewController = [storyboard instantiateInitialViewController];
http://stackoverflow.com/questions/6203109/loading-nsbundle-files-on-ios
@tokorom
tokorom / gist:7181753
Created October 27, 2013 13:05
MacのTerminalで画像の横幅と縦幅を知りたい場合
sips -g pixelWidth -g pixelHeight xxx.png
@tokorom
tokorom / gist:6820903
Created October 4, 2013 04:23
xcodebuild for Xcode 5
xcodebuild test -scheme Tests -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch 64-bit)'