This file contains hidden or 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
// save the info system button image to where you can access it, this should be able to | |
// go anywhere it gets run by an iPhone program, easiest if you do it with the simulator | |
UIButton *info = [UIButton buttonWithType:UIButtonTypeInfoLight]; | |
NSData *img = UIImagePNGRepresentation([info imageForState:UIControlStateNormal]); | |
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"info.png"]; | |
[img writeToFile:path atomically:NO]; | |
NSLog(@"%@", path); |
This file contains hidden or 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
- (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength data:(NSData *)imgData { | |
static const char *encodingTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
const unsigned char *bytes = [imgData bytes]; | |
NSMutableString *result = [NSMutableString stringWithCapacity:[imgData length]]; | |
unsigned long ixtext = 0; | |
unsigned long lentext = [imgData length]; | |
long ctremaining = 0; | |
unsigned char inbuf[3], outbuf[4]; | |
short i = 0; |
This file contains hidden or 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
iOsScrollingToggle : function(enabled){ | |
function preventScroll(e){ | |
e.preventDefault(); | |
e.stopPropagation(); | |
} | |
// This should prevent people from scrolling away from the modal window without closing it | |
if(enabled){ | |
document.body.removeEventListener('touchmove',preventScroll,false); | |
} else { | |
document.body.addEventListener('touchmove',preventScroll,false); |
This file contains hidden or 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
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; | |
NSArray *fontNames; | |
NSInteger indFamily, indFont; | |
for (indFamily=0; indFamily<[familyNames count]; ++indFamily) { | |
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]); | |
fontNames = [[NSArray alloc] initWithArray: [UIFont fontNamesForFamilyName: [familyNames objectAtIndex:indFamily]]]; | |
for (indFont=0; indFont<[fontNames count]; ++indFont) { | |
NSLog(@"Font name: %@", [fontNames objectAtIndex:indFont]); | |
} | |
[fontNames release]; |
This file contains hidden or 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
<!-- Sample usage: http://localhost/convert/gist.github.com/gists/128733 --> | |
<!-- Hardcoded charset bug to be sorted out yet --> | |
<?php $f = file("http://".$_SERVER['QUERY_STRING']); ?> | |
<?php header("Content-type: text/html; charset=cp1251"); ?> | |
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"> | |
<style> body { width: 320px !important; } nobr {white-space: normal !important; } dd { margin: 5px 10px;} </style> | |
<?php echo implode($f, "") ?> |
This file contains hidden or 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
NSString *id = [[UIDevice currentDevice] uniqueIdentifier]; |
This file contains hidden or 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
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"Some debugging"); | |
#else | |
// Do nothing! | |
#end |
This file contains hidden or 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
(function($) { | |
var userAgent = navigator.userAgent.toLowerCase(); | |
$.extend($.browser, { | |
iphone: $.browser.safari && /iphone/.test(userAgent), | |
chrome: $.browser.safari && /chrome/.test(userAgent) | |
}); | |
})(jQuery); |
This file contains hidden or 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
- (BOOL)application:(UIApplication *)application | |
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | |
[self.window addSubview:self.splitVC.view]; | |
} else { | |
[self.window addSubview:self.navigationController.view]; | |
} | |
[self.window makeKeyAndVisible]; | |
return YES; |
This file contains hidden or 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
UIApplication sharedApplication].idleTimerDisabled = YES; |