Skip to content

Instantly share code, notes, and snippets.

View weekwood's full-sized avatar
🎯
Focusing

Di Wu weekwood

🎯
Focusing
View GitHub Profile
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@weekwood
weekwood / scriptsort.sh
Created November 28, 2012 18:53 — forked from jprante/scriptsort.sh
Scripted sorting
curl -XDELETE 'localhost:9200/scriptsort'
curl -XPOST 'localhost:9200/scriptsort' -d '
{
"mappings": {
"test": {
"_id": {
"index" : "not_analyzed",
"stored": "yes"
}
@weekwood
weekwood / gist:4129679
Created November 22, 2012 06:27
objective-c Shaking
static BOOL AccelerationIsShaking(UIAcceleration* last, UIAcceleration* current, double threshold) {
double
deltaX = fabs(last.x - current.x),
deltaY = fabs(last.y - current.y),
deltaZ = fabs(last.z - current.z);
return
(deltaX > threshold && deltaY > threshold) ||
(deltaX > threshold && deltaZ > threshold) ||
(deltaY > threshold && deltaZ > threshold)
defaults write com.omnigroup.OmniFocus RelativeDateFormatterShowTime YES