most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat| #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"]; |
| // | |
| // UIDeviceHardware.h | |
| // | |
| // Used to determine EXACT version of device software is running on. | |
| #import <Foundation/Foundation.h> | |
| @interface UIDeviceHardware : NSObject | |
| - (NSString *) platform; |
| // | |
| // FMInfoPanelViewController.h | |
| // Created by Florian Mielke (@FlorianMielke) on 06.12.11. | |
| // | |
| #import <UIKit/UIKit.h> | |
| #import <Foundation/Foundation.h> | |
| #import <QuartzCore/QuartzCore.h> | |
| @interface FMInfoPanelViewController : UIViewController <UIScrollViewDelegate> |
| /*when you use an onclick event in an html element,iPhone webkit browser would have a delay.So you should deal with it.This part of js would help you.You just need to add this file in your html page and use ontouchstart/ontouchend/ontouchmove to replace onclick event */ | |
| /* 当你在使用onclick事件的时候,iPhone手机上面的safari浏览器会对事件产生一个延误(大概是0.3秒左右),这个时候你必须对这个事件作出一些处理。 然后用ontouchstart ontouchend ontouchmove去代替原本的onclick事件即可*/ | |
| /* how to use it? <a onclick="alert('touch me');">Touch Me</a> that's it */ | |
| /* 怎么用它,<a ontouchstart="alert('摸我一下');">摸我</a> that's it */ | |
| function NoClickDelay(el) { | |
| this.element = el; |
| /* Copied, Pasted and summarized from ps' source code. | |
| You can use sysctl to get other process' argv. | |
| */ | |
| #include <sys/sysctl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define pid_of(pproc) pproc->kp_proc.p_pid |
| /** | |
| * 新浪微博mid与url互转实用工具 | |
| * 作者: XiNGRZ (http://weibo.com/xingrz) | |
| */ | |
| var WeiboUtil = { | |
| // 62进制字典 | |
| str62keys: [ | |
| "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", | |
| "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", |
| // 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);"]; |
| #import <arpa/inet.h> | |
| #import <ifaddrs.h> | |
| #import <net/if.h> | |
| BOOL localWiFiAvailable( void ) | |
| { | |
| struct ifaddrs *addresses; | |
| struct ifaddrs *cursor; | |
| BOOL wiFiAvailable = NO; |