Skip to content

Instantly share code, notes, and snippets.

View alex-cellcity's full-sized avatar

Alex Yao Cheng alex-cellcity

  • CellCity Ltd.
  • Singapore
View GitHub Profile
@alex-cellcity
alex-cellcity / teams.json
Created April 3, 2012 09:55
example of Premier League Teams data
[
{
"gourp": "Under 6",
"teams": [
"JSSL Walcott",
"JSSL Wilshere",
"JSSL Arshavin",
"Shoot Football Academy",
"JSSL Tanglin/UWC",
"ANZA"
@alex-cellcity
alex-cellcity / solve_pbxproj_merge_conflict.sh
Created April 3, 2012 09:25 — forked from zbyhoo/solve_pbxproj_merge_conflict.sh
Solving pbxproj files git merge conflicts when two users add files at the same time.
#!/bin/sh
projectfile=`find -d . -name 'project.pbxproj'`
projectdir=`echo *.xcodeproj`
projectfile="${projectdir}/project.pbxproj"
tempfile="${projectdir}/project.pbxproj.out"
savefile="${projectdir}/project.pbxproj.mergesave"
cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile
cp $projectfile $savefile
@alex-cellcity
alex-cellcity / gist:2290627
Created April 3, 2012 09:23 — forked from zbyhoo/gist:1450703
print sorted by size list of all files/folders in current directory in human readable form
du -s * | sort -nr | cut -f2- | xargs -I {} du -hs {}
#!/bin/sh
# Map LISTENing TCP ports to their PIDs using lsof
LSOF=/usr/sbin/lsof
# e.g. netstat -an
# 127.0.0.1.25 *.* 0 0 49152 0 LISTEN
# *.22 *.* 0 0 49152 0 LISTEN
@interface UIImage (fixOrientation)
- (UIImage *)fixOrientation;
@end
@alex-cellcity
alex-cellcity / .gitconfig
Created October 11, 2011 06:55
Use FileMerge as Git diff tool
...
[diff]
external = /usr/local/bin/gitdiffcmd.sh
@alex-cellcity
alex-cellcity / UIColor+RGBHex.m
Created September 27, 2011 02:54
UIColor RGB Hex
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
@alex-cellcity
alex-cellcity / HowToUse.m
Created September 2, 2011 06:50
ShareKit share facebook stream with image (Stream Attachments)
NSString *title = @"Sed adipiscing ornare risus. Morbi est est, blandit sit amet, sagittis vel, euismod vel, velit. Pellentesque egestas sem. Suspendisse commodo ullamcorper magna.";
NSString *imageURL = @"http://img.chinaluxus.com/pic/spts/2011/05/19/20110519080415136.jpg";
NSURL *url = [NSURL URLWithString:@"http://example.com"];
SHKItem *item = [SHKItem URL:url title:title];
[item setCustomValue:imageURL forKey:FBImageURL];
[SHKFacebook shareItem:item];
@alex-cellcity
alex-cellcity / SynthesizeSingleton.h
Created August 16, 2011 02:33
SynthesizeSingleton
//
// SynthesizeSingleton.h
// CocoaWithLove
//
// Created by Matt Gallagher on 20/10/08.
// Copyright 2009 Matt Gallagher. All rights reserved.
//
// Permission is given to use this source code file without charge in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
#temp file
.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3