Skip to content

Instantly share code, notes, and snippets.

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

Nicholas Tau demonnico

💭
📱📱📱
View GitHub Profile
@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 / resign.sh
Last active May 5, 2019 12:22
resign ipa file
#First of all, create a new plist file named 'channnel.plist' and refer into your project.
#Second, move codes below in 'didFinishLaunchingWithOptions'
#NSString * channelPath = [[NSBundle mainBundle] pathForResource:@"channel" ofType:@"plist"];
#NSDictionary*channelDic= [NSDictionary dictionaryWithContentsOfFile:channelPath];
#NSString * channelIdentify = [channelDic objectForKey:@"channel"];
#[MobClick startWithAppkey:UMENG_KEY reportPolicy:BATCH channelId:channelIdentify];
#last step, 'cd' into the folder where xxx.ipa is there.
#generally, it's the name of scheme
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@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 / 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
@demonnico
demonnico / 9icons.sh
Created May 5, 2014 09:10
Make it easy to create all the icons we needed in iOS application.
#imagemagick is needed http://www.imagemagick.org/
#reference: http://stackoverflow.com/questions/18663013/icon-file-names-ios-7
convert $1 -resize 29x29 Icon-Small.png
convert $1 -resize 58x58 Icon-Small@2x.png
convert $1 -resize 40x40 Icon-40.png
convert $1 -resize 80x80 Icon-40@2x.png
convert $1 -resize 57x57 Icon.png
convert $1 -resize 114x114 Icon@2x.png
convert $1 -resize 120x120 Icon-60@2x.png
convert $1 -resize 76x76 Icon-76.png