Skip to content

Instantly share code, notes, and snippets.

View zacdaryl's full-sized avatar

zacdaryl

View GitHub Profile

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@zacdaryl
zacdaryl / generate-config.sh
Created September 12, 2019 07:58
Create new config file from template
#!/usr/bin/env bash
fileName=$1
version=$2
mkdir -p ipa/${version}
# generate plist file
cp template-plist.plist ipa/${version}/${fileName}
ipaName=`echo ${fileName} | sed "s/.plist/.ipa/"`
@zacdaryl
zacdaryl / Android-Gist.md
Created May 16, 2019 09:26
android gist

Android Gist

look content of *.jks

keytool -list -v -keystore your_jks_file_name.jks

@zacdaryl
zacdaryl / iOS-develop.md
Created April 26, 2019 04:45
iOS develop gist

iOS Develop Gist

禁止、恢复屏幕点击事件

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

[[UIApplication sharedApplication] endIgnoringInteractionEvents];
@zacdaryl
zacdaryl / indicator.md
Created April 26, 2019 04:39
UIActivityIndicatorView的使用
_indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhite];
_indicatorView.hidesWhenStopped = YES;

//set indicator to center of screen
CGFloat width = [UIScreen mainScreen].bounds.size.width;
CGFloat height = [UIScreen mainScreen].bounds.size.height;
_indicatorView.center = CGPointMake(width / 2, height / 2);
	
//scale to 1.5
@zacdaryl
zacdaryl / DeviceInfo.java
Created April 18, 2019 08:10
Android get device info
public static final String SP_DEVICE_ID_KEY = "sp_device_id";
private WeakReference<Context> weakContext;
private SharedPreferences sp;
public DeviceInfo(Context context) {
weakContext = new WeakReference<>(context);
sp = PreferenceManager.getDefaultSharedPreferences(context);
}
NSString *timestamp = [NSString stringWithFormat: @"%.0f", [[NSDate date] timeIntervalSince1970 ] * 1000];
@zacdaryl
zacdaryl / DeviceInfo.m
Created April 12, 2019 10:17
iOS device info
//get device model, for example: iphone7,2
-(NSString *)model {
struct utsname systemInfo;
uname(&systemInfo);
return [NSString stringWithCString: systemInfo.machine encoding: NSUTF8StringEncoding];
}
-(NSString *)deviceID {
UIDevice *device = [UIDevice currentDevice];
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (MD5)
- (NSString *)MD5;
@end
@zacdaryl
zacdaryl / delete_merged_branches.sh
Last active March 22, 2019 07:58
Delete branches which have merged
#!/bin/bash
# Delete remote branches which have merged to master
if [[ $1 == '-r' ]]; then
git branch --all --merged remotes/origin/master | \
grep --invert-match master | \
grep --invert-match HEAD | \
grep "remotes/origin/" | \
cut -d "/" -f 3- | \
xargs -n 1 git push --delete origin