Skip to content

Instantly share code, notes, and snippets.

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);
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];
<!-- 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, "") ?>
NSString *id = [[UIDevice currentDevice] uniqueIdentifier];
#if TARGET_IPHONE_SIMULATOR
NSLog(@"Some debugging");
#else
// Do nothing!
#end
(function($) {
var userAgent = navigator.userAgent.toLowerCase();
$.extend($.browser, {
iphone: $.browser.safari && /iphone/.test(userAgent),
chrome: $.browser.safari && /chrome/.test(userAgent)
});
})(jQuery);
- (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;
UIApplication sharedApplication].idleTimerDisabled = YES;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
public class MyDatasource : UITableViewDataSource
{
object[] dataArray;
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
NSSet *touches = [event allTouches];
BOOL forwardToSuper = YES;
for (UITouch *touch in touches) {
if ([touch tapCount] >= 2) {
// prevent this
forwardToSuper = NO;
}
}
if (forwardToSuper){