Skip to content

Instantly share code, notes, and snippets.

@kythanh
kythanh / sencha touch and phonegap
Created April 10, 2014 06:57
Quick steps to create an Sencha Touch with PhoneGap supported
1. sencha -sdk /path/to/Sencha Touch SDK/touch-x.x.x generate app /path/to/app/<AppFolder> <AppName>
2. sencha phonegap init <app bundle id> <AppName>
3. sencha app build -run native
@kythanh
kythanh / how to remove all subviews of uiview iOS
Created April 17, 2014 06:09
how to remove all subviews of uiview iOS
We got serveral way to archive this:
1. [[currentView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
2. Using loop:
for(UIView *subview in [currentView subviews]) {
[subview removeFromSuperview];
}
@kythanh
kythanh / gist:11392250
Created April 29, 2014 06:40
Hide status bar iOS 7
Hide status bar iOS 7
adding "View controller-based status bar appearance" = NO to plist
@kythanh
kythanh / Download and save image with AFNetworking on iOS
Created May 12, 2014 04:07
Download and save image with AFNetworking on iOS
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString: url]];
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest: request];
requestOperation.responseSerializer = [AFImageResponseSerializer serializer];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
//NSLog(@"Response: %@", responseObject);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documents = [paths objectAtIndex:0];
NSString *finalPath = [docum
@kythanh
kythanh / How to delete all Archive binaries generated by XCode
Created August 7, 2014 07:03
How to delete all Archive binaries generated by XCode
1. Open Terminal, then goto this folder: cd ~/Library/Developer/Xcode/Archives
2. Perform delete all folders and files: rm -rf *
You may need root permission to perform delete.
{
"country": "Australia",
"iso_country": "AU",
"price_unit": "USD",
"outbound_sms_prices": [
{
"mcc": "505",
"mnc": "1",
"carrier": "Telstra",
"prices": [
@kythanh
kythanh / fullquery
Created July 2, 2016 15:40 — forked from OllieJones/fullquery
Fast nearest-location finder for SQL (MySQL, PostgreSQL, SQL Server)
SELECT zip, primary_city,
latitude, longitude, distance
FROM (
SELECT z.zip,
z.primary_city,
z.latitude, z.longitude,
p.radius,
p.distance_unit
* DEGREES(ACOS(COS(RADIANS(p.latpoint))
* COS(RADIANS(z.latitude))
@kythanh
kythanh / web.config
Created December 30, 2016 04:17
Log4Net - RollingLogFileAppender sample
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs\serverlog" />
<appendToFile value="true" />
<datePattern value="_yyyy.MM.dd&quot;.log&quot;" />
<preserveLogFileNameExtension value="true"/>
<rollingStyle value="Composite" />
<maxSizeRollBackups value="-1" />
<maximumFileSize value="5MB" />
<staticLogFileName value="false" />
@kythanh
kythanh / gist:b42f34223014789fc45ad5e8a71e864b
Created January 19, 2017 07:31
How to lookup app info on App Store by app id.
URL Template:
http://itunes.apple.com/<country code>/lookup/?id=<app_id>
Ex: http://itunes.apple.com/us/lookup/?id=1149226616
@kythanh
kythanh / xcode_derivedData.sh
Created February 7, 2017 06:57
Xcode DerivedData data path
~/Library/Developer/Xcode/DerivedData