Skip to content

Instantly share code, notes, and snippets.

View sugarmo's full-sized avatar
🏠
Working from home

Steven Mok sugarmo

🏠
Working from home
View GitHub Profile
@sugarmo
sugarmo / warn-for-todo-or-fixme-comments.sh
Created October 9, 2013 09:19
Warn for TODO or FIXME comments.
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" -ipath "${SRCROOT}/pods" -prune -o \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@sugarmo
sugarmo / GitHub Ver.Mok.css
Created October 12, 2013 02:58
GitHub css for Mou app.
body {
font-family: Helvetica, arial, freesans, clean, sans-serif;
font-size: 15px;
line-height: 1.7;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@sugarmo
sugarmo / switch-xcode.sh
Created October 16, 2013 06:11
Switch Xcode.
sudo xcode-select -switch /Applications/Xcode.app
@interface Person : NSObject
@property (nonatomic, copy) NSMutableArray *friendNames;
@end
@implementation Person
- (id)init{
self = [super init];
@sugarmo
sugarmo / find-unused-images
Created January 17, 2014 09:29
Find unused images
#!/bin/bash
# Escape code
esc=`echo -en "\033"`
# Set colors
cc_red="${esc}[0;31m"
cc_green="${esc}[0;32m"
cc_yellow="${esc}[0;33m"
cc_blue="${esc}[0;34m"
@sugarmo
sugarmo / gist:987f9b058d0b23747ebb
Created May 14, 2014 09:18
Force Device to Rotate
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), newOrientation);
}
@sugarmo
sugarmo / sugarbash.sh
Last active May 21, 2018 05:46
An useful bash source file for Mac OS X.
# 我的命令库
# 编辑命令
sg-cmdedit() {
subl ~/Documents/sugarbash.sh
}
# 重新加载命令
sg-cmdreload() {
source ~/Documents/sugarbash.sh
@sugarmo
sugarmo / ExtensionNamespace.swift
Last active September 1, 2018 04:29
Swift Extension with Namespace
public protocol NamespaceWrappable {
associatedtype T
var ex: T { get }
static var ex: T.Type { get }
}
extension NamespaceWrappable {
public var ex: TypeWrapper<Self> {
return TypeWrapper(value: self)
}
@sugarmo
sugarmo / simctl.sh
Created December 12, 2019 09:48
Xcode 控制状态栏
xcrun simctl status_bar <device> [list | clear | override <override arguments>]
@sugarmo
sugarmo / InteractiveVisorViewController.swift
Created December 24, 2019 09:41 — forked from quantcon/InteractiveVisorViewController.swift
How to use UIPercentDrivenInteractiveTransition in one file
//
// ViewController.swift
// Interactive Animated Presentation
// "Visor" Effect
//
import UIKit
class ViewController: UIViewController {