Skip to content

Instantly share code, notes, and snippets.

@linktoming
linktoming / gist:1479712
Created December 15, 2011 03:33
Gesture Recognition
/********************************************************************
* Add Recognizer to view
*
* UITapGestureRecognizer
* UISwipeGestureRecognizer
* UIPinchGestureRecognizer
* UIRotationGestureRecognizer
* UIPanGestureRecognizer
* UILongPressGestureRecognizer
*/
@linktoming
linktoming / SCAppUtils.h
Created December 15, 2011 04:24 — forked from scelis/SCAppUtils.h
Add a background image to your UINavigationBar.
#import <UIKit/UIKit.h>
#define kSCNavigationBarBackgroundImageTag 6183746
#define kSCNavigationBarTintColor [UIColor colorWithRed:0.54 green:0.18 blue:0.03 alpha:1.0]
@interface SCAppUtils : NSObject
{
}
+ (void)customizeNavigationController:(UINavigationController *)navController;
@linktoming
linktoming / gist:1486599
Last active September 28, 2015 19:38
Git Command
1. To Setup Git:
$git --version
$git config --global user.name "Your Name"
$git config --global user.email "Your Email Address"
$git config --global color.ui "auto"
$git config --global alias.co checkout
$git config --global core.editor "mate -w"
2. To Generate SSH Key for SSH Connection:
@linktoming
linktoming / gist:1495829
Created December 19, 2011 07:10
UIResponder's Touch Handling
#pragma mark -
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
messageLabel.text = @"Touches Began";
[self updateLabelsFromTouches:touches];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
messageLabel.text = @"Drag Detected";
[self updateLabelsFromTouches:touches];
@linktoming
linktoming / gist:1497555
Created December 19, 2011 14:56
Rename Files in Python
import os
i=1
for file in os.listdir("/Users/****/Downloads/Episode1"):
if os.path.splitext(file)[1] == ".gif":
os.rename(file, "2011_11_"+str(i)+".gif")
i+=1
@linktoming
linktoming / gist:1508835
Created December 22, 2011 03:50
Type Convert iOS
NSString* aStr;
aStr = [[NSString alloc] initWithData:aData encoding:NSASCIIStringEncoding];
NSData* aData;
aData = [aStr dataUsingEncoding: NSASCIIStringEncoding];
@linktoming
linktoming / gist:1531202
Created December 29, 2011 02:17
iOS File and Direcotry
// Document Folder
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filename = [documentsDirectory stringByAppendingPathComponent:@"theFile.txt"];
// Temp Folder
NSString *tempPath = NSTemporaryDirectory();
NSString *tempFile = [tempPath stringByAppendingPathComponent:@"tempFile.txt"];
@linktoming
linktoming / gist:1604335
Created January 13, 2012 02:50
Useful Sqlite3 Command
1. List all the tables
sqlite> .tables
2. List the structure of a table
sqlite> PRAGMA table_info([ZCLIENT]);
3. Exit
sqlite> .exit
4. Open a database file
@linktoming
linktoming / gist:2246285
Created March 30, 2012 03:42
NSDateFormatter formatting strings reference
a: AM/PM
A: 0~86399999 (Millisecond of Day)
c/cc: 1~7 (Day of Week)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
d: 1~31 (0 padded Day of Month)
D: 1~366 (0 padded Day of Year)
@linktoming
linktoming / Description
Created March 30, 2012 16:34
Batch Delete Amazon Kindle Library Items
Credit and Usage: http://www.mobileread.com/forums/showthread.php?t=162972