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) | |
# | |
# Inspired by original script by incanus: | |
# https://gist.github.com/1186990 | |
# | |
# Rewritten by martijnthe: | |
# https://gist.github.com/1379127 | |
# |
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
// From: http://iphoneincubator.com/blog/windows-views/how-to-inject-javascript-functions-into-a-uiwebview | |
NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; | |
[webView stringByEvaluatingJavaScriptFromString:@"var script = document.createElement('script');" | |
"script.type = 'text/javascript';" | |
"script.text = \"function myFunction() { " | |
"var field = document.getElementById('field_3');" | |
"field.value='Calling function - OK';" | |
"}\";" | |
"document.getElementsByTagName('head')[0].appendChild(script);"]; |
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
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; | |
[animation setToValue:[NSNumber numberWithFloat:-M_PI/128]]; | |
[animation setFromValue:[NSNumber numberWithDouble:M_PI/128]]; | |
[animation setDuration:0.09]; | |
[animation setRepeatCount:NSUIntegerMax]; | |
[animation setAutoreverses:YES]; |
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
#import <arpa/inet.h> | |
#import <ifaddrs.h> | |
#import <net/if.h> | |
BOOL localWiFiAvailable( void ) | |
{ | |
struct ifaddrs *addresses; | |
struct ifaddrs *cursor; | |
BOOL wiFiAvailable = NO; |
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
+ (void)pulseView:(UIView *)view completion:(void (^)(void))block { | |
// if you use auto layout, view-based transform go haywire, as they trigger layoutSubviews | |
// consequence is that you have no idea where the view will end up on the screen once animation completes | |
// see this discussion: http://stackoverflow.com/questions/12943107/how-do-i-adjust-the-anchor-point-of-a-calayer-when-auto-layout-is-being-used | |
// thus (per solution 4 from link above), rewriting with CAKeyframeAnimation | |
CAKeyframeAnimation *ka = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; | |
ka.duration = .49; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>SKVariables</key> | |
<array> | |
<dict> | |
<key>enabled</key> | |
<true/> | |
<key>name</key> |
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
Over time, I collected some options to make Firefox really fast. | |
WARNING! NO WARRANTY, use on your own risk! | |
If you know what you're doing, go to 'about:config' and edit the listed values accordingly. | |
Hint: Double-click boolean values to toggle true/false. | |
########################### | |
If mouse-wheel scrolling is slow, try |
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
#import <UIKit/UIKit.h> | |
#import <ImageIO/ImageIO.h> | |
#import <MobileCoreServices/MobileCoreServices.h> | |
- (void)exportAnimatedGif | |
{ | |
UIImage *shacho = [UIImage imageNamed:@"shacho.png"]; | |
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"]; | |
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"]; |
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
// | |
// Copyright (c) 2012-2015 Cédric Luthi / @0xced. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#if TARGET_OS_SIMULATOR | |
static const char *fakeCarrier; | |
static const char *fakeTime; |
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
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]]; | |
NSData *imageData = UIImageJPEGRepresentation(image, 1.0); | |
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; | |
[request setHTTPShouldHandleCookies:NO]; | |
[request setTimeoutInterval:60]; | |
[request setHTTPMethod:@"POST"]; | |
NSString *boundary = @"unique-consistent-string"; |
OlderNewer