Skip to content

Instantly share code, notes, and snippets.

View MrBoog's full-sized avatar
🏎️
vroom vroom

HuanLiu MrBoog

🏎️
vroom vroom
View GitHub Profile
@MrBoog
MrBoog / backup.swift
Created January 18, 2019 10:11
demo for scripting swift
#!/usr/bin/swift
import Foundation
func backup() {
let args = CommandLine.arguments
guard args.count > 1 else {
return print("Backup Failed! : \n Detail: Missing commit message whick should be surrounded by quotation mark.")
}
let arg = args[1]
@MrBoog
MrBoog / UITabBar+Badge.swift
Last active February 1, 2023 16:24
UITabBar+Badge
import Foundation
fileprivate let tabBarItemTag: Int = 10090
extension UITabBar {
public func addItemBadge(atIndex index: Int) {
guard let itemCount = self.items?.count, itemCount > 0 else {
return
@MrBoog
MrBoog / objectivec-nil.md
Last active August 29, 2015 14:05
空值
标志 含义
NULL (void *)0 C指针的字面零值
nil (id)0 Objective-C对象的字面零值
Nil (Class)0 Objective-C类的字面零值
NSNull [NSNull null] 用来表示零值的单独的对象
@MrBoog
MrBoog / CONSTS.h
Created March 13, 2014 14:14
SYSTEM_VERSION
//iOS7
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
@MrBoog
MrBoog / MyDeleteCell.m
Last active August 29, 2015 13:57
FIX UITableViewCell UITableViewCellEditingStyleDelete issue in iOS7
// override : layoutSubviews
- (void)layoutSubviews
{
[super layoutSubviews];
self.backgroundColor = [UIColor clearColor];
for (UIView *subview in self.subviews) {