An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
// | |
// KSDIdlingWindow.h | |
// | |
// Created by Brian King on 4/13/10. | |
// Copyright 2010 King Software Designs. All rights reserved. | |
// | |
// Based off: | |
// http://stackoverflow.com/questions/273450/iphone-detecting-user-inactivity-idle-time-since-last-screen-touch | |
// |
CABasicAnimation *positionAnimation; | |
positionAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; | |
positionAnimation.fromValue = [NSValue valueWithCGPoint:fromPosition]; | |
positionAnimation.toValue = [NSValue valueWithCGPoint:toPosition]; | |
CABasicAnimation *alphaAnimation; | |
alphaAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; | |
alphaAnimation.fromValue = [NSNumber numberWithFloat:fromAlpha]; | |
alphaAnimation.toValue = [NSNumber numberWithFloat:toAlpha]; | |
CGFloat borderWidth = 3.f; | |
CGFloat circleRadius = self.bounds.size.width / 2 - borderWidth; | |
CGPoint circleCenter = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextSetStrokeColorWithColor(context, [[UIColor colorWithRed:255.0/255.0 green:210.0/255.0 blue:60.0/255.0 alpha:1] CGColor]); | |
UIBezierPath *firstHalf = [UIBezierPath bezierPath]; |
convert -coalesce googlechrome.gif target.png |
@interface UIImage(WebP) | |
- (id)initWithWebPData:(NSData *)data; | |
@end |
UIViewController* avc = [[UIViewController alloc] init]; | |
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(50,50,100,100)]; | |
view.backgroundColor = [UIColor redColor]; | |
[avc.view addSubview:view]; | |
UIWindow* ow = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds]; | |
ow.windowLevel = UIWindowLevelAlert; | |
ow.backgroundColor = [UIColor clearColor]; | |
ow.rootViewController = avc; | |
[ow makeKeyAndVisible]; |
MPMusicPlayerController* player = [MPMusicPlayerController iPodMusicPlayer]; | |
//get now playing item | |
if (player.playbackState == MPMusicPlaybackStatePlaying) { | |
MPMediaItem*item = [player nowPlayingItem]; | |
NSLog(@"playing %@",[item valueForProperty:MPMediaItemPropertyTitle]); | |
} |
#define NSNullObjects @[@"",@0,@{},@[]] | |
@interface NSNull (InternalNullExtention) | |
@end | |
@implementation NSNull (InternalNullExtention) | |
CMMotionManager *_motionManager = [[CMMotionManager alloc] init]; | |
_motionManager.accelerometerUpdateInterval = 0.1; | |
__block UIDeviceOrientation orientationLast = UIDeviceOrientationPortrait; | |
[_motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) { | |
UIDeviceOrientation orientationNew; | |
if (accelerometerData.acceleration.x >= 0.75) { | |
orientationNew = UIDeviceOrientationLandscapeRight; | |
} | |
else if (accelerometerData.acceleration.x <= -0.75) { | |
orientationNew = UIDeviceOrientationLandscapeLeft; |