Skip to content

Instantly share code, notes, and snippets.

View demonnico's full-sized avatar
💭
📱📱📱

Nicholas Tau demonnico

💭
📱📱📱
View GitHub Profile
@demonnico
demonnico / check.m
Created December 9, 2013 14:41
check all app's version info in your iphone.
#import <dlfcn.h>
- (NSMutableArray *)browseInstalled
{
NSMutableArray *installedArray = installedApplications();
return installedArray;
}
typedef NSDictionary *(*PMobileInstallationLookup)(NSDictionary *params, id callback_unknown_usage);
@demonnico
demonnico / NSStirng+Util.m
Created December 3, 2013 05:39
get totally files size in directory
@impelementaton NSString(Utils)
+ (uint64_t)sizeAtPath:(NSString *)filePath diskMode:(BOOL)diskMode
{
uint64_t totalSize = 0;
NSMutableArray *searchPaths = [NSMutableArray arrayWithObject:filePath];
while ([searchPaths count] > 0)
{
@autoreleasepool
{
NSString *fullPath = [searchPaths objectAtIndex:0];
@demonnico
demonnico / Util.h
Last active December 21, 2015 17:29
nice helper to code.
#import <objc/runtime.h>
//iPhone4's wallpaper size in iOS7
#define kWallpaperSizeNomal CGSizeMake(370.0,598.0)
//iPhone5's wallpaper size in iOS7
#define kWallpaperSizeSpec CGSizeMake(372.0,696.0)
//esay to get the string value of patameter's name.
#define NameStringOfParam(param) [NSString stringWithFormat:@"%s", #param]
//add accessor(setter getter) for category by define.
#define SYNTHESIZE_CATEGORY_OBJ_PROPERTY(propertyGetter, propertySetter) \
@demonnico
demonnico / statist.sh
Created June 14, 2013 07:37
统计项目中代码行数
//.m文件的行数
find . -name "*.m" | xargs wc -l
//.m .h .xib .c 文件内容总行数
find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs grep -v "^$"|wc -l
@demonnico
demonnico / SDK.podspec
Created June 13, 2013 11:13
cocoapod local pod config
Pod::Spec.new do |s|
s.name = 'SDK'
s.version = '1.0.0'
s.license = 'Commercial'
s.summary = 'SDK summary'
s.homepage = 'https://sdkhomepage.com/'
s.author = { 'SDK author' => 'https://sdkauthor.com/' }
s.source = { :git => '~/Desktop/SDK' }
s.platform = :ios
s.source_files = '**/*.h'
APP = Pages
WORKSPACE = Pages
CONFIG = InHouse
SCHEME = PagesInHouse
ICON_NAME = Icon@2x.png
BASE_URL = http://beta.nsnotfound.com/pages
EMAIL_LIST = newproject@lexrus.mailgun.org
EMAIL_DOMAIN = lexrus.mailgun.org
SFTP_SERVER = lex@nsnotfound.com
@demonnico
demonnico / markversion.sh
Created June 9, 2013 01:53
To Mark a version number,git commit hash and branch name on a image, it can be your App's icons.
commit=`git rev-parse --short HEAD`
branch=`git rev-parse --abbrev-ref HEAD`
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"`
function processIcon() {
export PATH=$PATH:/usr/local/bin
base_file=$1
base_path=`find ${SRCROOT} -name $base_file`
if [[ ! -f ${base_path} || -z ${base_path} ]]; then