This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (instancetype)viewFromXIB | |
{ | |
UINib *nib = [UINib nibWithNibName:NSStringFromClass([self class]) bundle:[NSBundle bundleForClass:[self class]]]; | |
NSArray *objects = [nib instantiateWithOwner:nil options:nil]; | |
for (id obj in objects) { | |
if ([obj isKindOfClass:[self class]]) { | |
return obj; | |
} | |
} | |
NSAssert(NO, @"Can't load view from XIB"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find_project_or_workspace() { | |
MASK=$1 | |
ALL_PROJECTS_OR_WORKSPACES=`/bin/ls -1 -d $MASK 2>/dev/null` | |
FILE_TO_OPEN='' | |
if [ z"${ALL_PROJECTS_OR_WORKSPACES}" != z ] ; then | |
for i in ${ALL_PROJECTS_OR_WORKSPACES} ; do | |
if [ z"${PROJECT}" == z ] ; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# language: ru | |
Функционал: Сборка iOS приложения | |
Чтобы не запоминать сложный набор параметров для xcodebuild | |
Разработчики | |
Хотят собирать iOS приложения одной простой командой | |
Сценарий: Сборка Xcode проекта | |
Допустим я нахожусь в папке с Xcode проектом | |
И настройками BuildKit для него | |
Когда я запускаю сборку проекта BuildKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
alert = UIAlertView.alloc.initWithTitle:'title', message:'message', delegate:nil, cancelButtonTitle:'Dismiss', otherButtonTitles:'Okay', nil | |
alert.show | |
true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# PackageApplication | |
# | |
# Copyright (c) 2009-2010 Apple Inc. All rights reserved. | |
# | |
# Package an iPhone Application into an .ipa wrapper | |
# | |
use Pod::Usage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang test.m -o test -framework Foundation -f-arc | |
#import <Foundation/Foundation.h> | |
@interface Foo : NSObject | |
@property (nonatomic, copy) NSString * bar; | |
@end | |
@implementation Foo | |
@synthesize bar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f \( -iname '*.m' -or -iname '*.h' \) -not -iname 'main.m' -print0 | xargs -0 wc -l | grep -v 'total' | awk 'BEGIN{ min = 4294967295; min_filename = ""; max = 0; max_filename = "" ; } { if ($1 < min) { min = $1; min_filename = $2; } ; if ($1 > max) { max = $1; max_filename = $2 } ; } END { print "min: ", min, "; file: ", min_filename ; print "max: ", max, "; file: ", max_filename ;} ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/xattr.h> | |
/// Set a flag that the files shouldn't be backuped to iCloud. | |
+ (void)addSkipBackupAttributeToFile:(NSString *)filePath { | |
u_int8_t b = 1; | |
setxattr([filePath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0); | |
} | |
/// Returns the legacy storage path, used when the com.apple.MobileBackup file attribute is not available. | |
+ (NSString *)legacyStoragePath { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
echo 'Remount the root partition as writable...' | |
/sbin/mount -uw / && echo 'Done' | |
echo 'Run Directory Services...' | |
launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist && echo 'Done' | |
dscl . -delete /Users/$1 | |
dscl . -delete /Groups/admin GroupMembership $1 | |
rm -rf /Users/$1 | |
rm /var/db/.AppleSetupDone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC ?= gcc | |
MACOSX_DEPLOYMENT_TARGET ?= 10.6 | |
SDKROOT ?= /Developer/SDKs/MacOSX10.6.sdk | |
VALID_ARCHS ?= i386 x86_64 | |
CFLAGS=-isysroot $(SDKROOT) -Os -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) | |
TOPDIR = $(PWD) | |
BUILD_DIR = build | |
BUILD_RESULTS_DIR = $(TOPDIR)/$(BUILD_DIR) |