Skip to content

Instantly share code, notes, and snippets.

View tanapon's full-sized avatar

Tanapon Petapanpiboon tanapon

View GitHub Profile
@tanapon
tanapon / BoundingBoxToParent.m
Created March 14, 2012 17:19
BoundingBoxToParent | Cocos2d
-(CGRect)boundingBoxOf:(CCNode*)node to:(CCNode*)parent
{
CGRect box = [node boundingBox];
CGPoint origin = box.origin;
origin.x = origin.x + parent.position.x;
origin.y = origin.y + parent.position.y;
box.origin = origin;
return box;
}
@tanapon
tanapon / NSString+NumberMethods.h
Created March 14, 2012 17:27
Adding Thousands Separator commas to a number manually without using NSNumber formatting method
//
// NSStringCategory.h
// AdamoCalc
//
// Created by Tanapon Petapanpiboon on 10/11/11.
// Copyright 2011 toptanapon@gmail.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@tanapon
tanapon / gist:4641089
Last active December 11, 2015 18:19
Twitter native iOS 5.0+ sharing dialog class method for Cocos2D 2.0+
+(void)displayTweetComposerWithInitialText:(NSString*)initialText
successBlock:(void(^)())successBlock
cancelBlock:(void(^)())cancelBlock
{
if ([TWTweetComposeViewController canSendTweet]) // Check if twitter is setup and reachable
{
AppController *app = (AppController*)[[UIApplication sharedApplication] delegate];
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/'
}
# Regular
txtblk='\e[0;30m' # Black
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue