This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL *URL = [NSURL URLWithString:@"http://example.com/"]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:URL]; | |
AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request]; | |
op.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; | |
op.responseSerializer =[AFHTTPResponseSerializer serializer]; | |
[op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSStringEncoding big5 = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingBig5_HKSCS_1999); | |
NSString *string = [[NSString alloc] initWithData:responseObject encoding:big5]; | |
NSLog(@"HTML: %@", string); | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL *URL = [NSURL URLWithString:@"http://example.com/"]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:URL]; | |
AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request]; | |
op.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; | |
op.responseSerializer =[AFHTTPResponseSerializer serializer]; | |
[op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { | |
// NSString* newStr = [NSString stringWithUTF8String:[responseObject bytes]]; | |
NSString* newStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; | |
NSLog(@"HTML: %@", newStr); | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL *URL = [NSURL URLWithString:@"http://example.com/"]; | |
NSString *postString = @"company=Locassa&quality=AWESOME!"; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL | |
cachePolicy:NSURLRequestUseProtocolCachePolicy | |
timeoutInterval:60.0]; | |
[request setHTTPMethod:@"POST"]; | |
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]]; | |
AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request]; | |
op.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; | |
op.responseSerializer =[AFHTTPResponseSerializer serializer]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# (Above line comes out when placing in Xcode scheme) | |
# | |
API_TOKEN=<TestFlight API token here> | |
TEAM_TOKEN=<TestFlight team token here> | |
SIGNING_IDENTITY="iPhone Distribution: Development Seed" | |
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/MapBox Ad Hoc.mobileprovision" | |
#LOG="/tmp/testflight.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Parameter check | |
if [[ "$1" == *'help' ]] || [[ "$1" == '-h' ]] ;then | |
echo "Usage:" | |
echo " Method 1:" | |
echo " \$ $0 <apk_apk_file> [start]" | |
echo | |
echo " Method 2:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function StopIfFail(){ | |
# http://www.dotkam.com/2008/10/24/getting-return-code-from-ant-in-shell/ | |
if [ $? -ne 0 ];then | |
echo "BUILD ERROR: see message above." | |
exit 1; | |
else | |
sleep 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Google Chrome" | |
activate | |
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl" | |
if (count every window) = 0 then | |
make new window | |
end if | |
set found to false | |
set theTabIndex to -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$devices = explode("\n", shell_exec("adb devices")); | |
$pattern = "/([a-zA-Z0-9]+)\s+device/"; | |
$zip = new ZipArchive; | |
if ($zip->open($argv[1]) === TRUE) { | |
$zip->extractTo('.', 'AndroidManifest.xml'); | |
$zip->close(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEVICE=`adb devices | sed '/List of devices/d' | sed '/:4444/d' | sed '/emulator/d' | sed '/vbox86p/d' | head -n 1 | awk '{print $1}'` | |
if [ "$DEVICE" == "" ]; then | |
echo "Please conntect devices!" | |
exit 0 | |
else | |
echo "Devices: "$DEVICE | |
fi | |
adb -s $DEVICE forward tcp:4444 localabstract:/adb-hub; adb connect localhost:4444 |
OlderNewer