Skip to content

Instantly share code, notes, and snippets.

View zld's full-sized avatar
👻

zld zld

👻
View GitHub Profile
#!/bin/sh
schema_folder="/Users/appbuilder/app_builder/source/ios/common/da_schema"
model_folder="/Users/appbuilder/app_builder/source/ios/common/da_model"
while getopts "ft:" o; do
case "${o}" in
f)
is_force="1"
echo "force"
@zld
zld / myYesterdayLog.sh
Created June 29, 2017 02:42
List what I have done yesterday
rm /Users/zld/Dev/yk/ylog
print_log() {
git log --since=yesterday.midnight --author=ZhuLida --pretty=format:%s | perl -pe '$_ .= "\n" unless /\n/' >> /Users/zld/Dev/yk/ylog
}
for repo in $(ls /Users/zld/Dev/yk/) /Users/zld/Dev/yk/24h/inke_ios
do
cd $repo &> /dev/null
print_log &> /dev/null
// disable inner keyboard
sudo kextunload /System/Library/Extensions/AppleHIDKeyboard.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
// re-enable it
sudo kextload /System/Library/Extensions/AppleHIDKeyboard.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
-(void)addRoundedCorners:(UIRectCorner)corners withRadii:(CGSize)radii {
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = self.bounds;
UIBezierPath *roundedPath = [UIBezierPath bezierPathWithRoundedRect: maskLayer.bounds byRoundingCorners:corners cornerRadii:radii];
// maskLayer.fillColor = [[UIColor yellowColor] CGColor];
maskLayer.backgroundColor = [[UIColor clearColor] CGColor];
maskLayer.path = [roundedPath CGPath];
self.layer.mask = maskLayer;
}
// http://stackoverflow.com/a/17329683/2138564
// File - UITabBar+IKTouch.m
#import "UITabBar+IKTouch.h"
#import "UIView+IKTouch.h"
@implementation UITabBar (IKTouch)
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {

Keybase proof

I hereby claim:

  • I am zld on github.
  • I am zld (https://keybase.io/zld) on keybase.
  • I have a public key whose fingerprint is EEA0 E512 D22E 9566 DD07 0EB5 09FA B4E0 7CD4 8B6A

To claim this, I am signing this object:

CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], rect);
UIImage *img = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
@zld
zld / insertOrReplaceObjects.m
Last active November 25, 2015 12:54
insert multiline datas into sqlite in Objective-C
+ (BOOL)insertOrReplaceObjects:(NSArray *)objects {
__block BOOL result = NO;
NSArray *properties = [self allColumbs];
[self inDatabase:^(FMDatabase *db) {
NSMutableString *sql = [NSMutableString stringWithFormat:@"insert or replace into %@ ", [self tableName]];
[sql appendFormat:@"('%@') values ",[properties componentsJoinedByString:@"','"]];
NSMutableArray *objectsValues = [[NSMutableArray alloc] init];
@zld
zld / user-rule.txt
Last active December 25, 2015 06:31
personal user-rule.txt for Shadowsocks
! Put user rules line by line in this file.
! See https://adblockplus.org/en/filter-cheatsheet
||stackoverflow.com
@@||163.com
@@||126.com
||xda-developers.com
||xda-cdn.com
||bluekai.com
||adhight.net
||iupload.co
@zld
zld / 0_reuse_code.js
Created October 28, 2015 07:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console