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 / 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 / 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 / Info.plist
Created August 31, 2013 04:20
发布破解包要添加的字段
<key>SignerIdentity</key>
<string>Apple iPhone OS Application Signing</string>
@sugarmo
sugarmo / center zooming view.m
Last active December 21, 2015 16:29
Center zooming view in scroll view -layoutSubview.
- (void)layoutSubviews {
[super layoutSubviews];
// center the image as it becomes smaller than the size of the screen
CGSize boundsSize = self.bounds.size;
CGRect frameToCenter = self.imageView.frame;
// center horizontally
if (frameToCenter.size.width < boundsSize.width) {
frameToCenter.origin.x = (boundsSize.width - frameToCenter.size.width) / 2;
} else {
frameToCenter.origin.x = 0;
@sugarmo
sugarmo / Mac Development Environment.md
Last active December 21, 2015 00:18
Mac Development Environment

Command Line tools

brew

mysql

node

rvm

@sugarmo
sugarmo / embed-github-things.md
Last active January 11, 2024 03:44
Embed Github Things (geoJSON, 3D model)

Embedding your geoJSON map elsewhere

<script src="https://embed.github.com/view/geojson/<username>/<repo>/<ref>/<path_to_file>"></script>

Embedding your 3D model elsewhere

@sugarmo
sugarmo / json-to-plist.sh
Last active December 6, 2020 03:06
A shell script for Automator that can convert JSON to .plist file.
for f in "$@"
do
filename="${f%.*}"
plutil -convert xml1 "$filename".json -o "$filename".plist
done
@sugarmo
sugarmo / theme.css
Created May 10, 2013 16:52
my tumblr's theme
code, tt {
margin: 0 2px;
padding: 0 5px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}
pre code {
@sugarmo
sugarmo / Doxygenize.rb
Last active December 16, 2015 14:29
a script for Mac service that can comment code automatically.
#! /usr/bin/ruby
#
# This script helps us make doxygen comments in obj-c files in Xcode
#
# Created by Fred McCann on 03/16/2010.
# http://www.duckrowing.com
#
module Duckrowing
@sugarmo
sugarmo / gist:5360862
Last active December 16, 2015 02:09
Various Parameters Method in Obj-C
- (void)method:(id)obj1,...
{
va_list args;
void *arg;
va_start(args,obj1);
while((arg = va_arg(args, void *)))
{
// Now you can use arg. This will only work when all arguments are objects.