An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
@implementation XCDUUID | |
+ (void) load | |
{ | |
// query runtime if NSUUID class already exists, if so => done | |
if (objc_getClass("NSUUID")) | |
{ | |
return; | |
} | |
// | |
// SmartPointer.h | |
// MemoryDemo | |
// | |
// Created by HangChen on 5/5/15. | |
// Copyright (c) 2015 HangChen. All rights reserved. | |
// | |
#ifndef __MemoryDemo__SmartPointer__ | |
#define __MemoryDemo__SmartPointer__ |
// | |
// AppDelegate.m | |
// RuntimeDemo | |
// | |
// Created by hangchen on 11/7/14. | |
// Copyright (c) 2014 hangchen. All rights reserved. | |
// | |
#import "AppDelegate.h" | |
#import <objc/runtime.h> |
此处主要参考 http://harryhsu.logdown.com/posts/198416-build-ffmpeg-on-mac-os-109 | |
根据我的编译过程做了适当修改 | |
1. Download NDK | |
https://developer.android.com/tools/sdk/ndk/index.html | |
我下载的版本是android-ndk-r10,不同的版本在下面的build脚中本需要修改的地方大致相同. | |
2. Download ffmpeg source code | |
下载 ffmpeg(http://www.ffmpeg.org/download.html) | |
推荐 git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg |
- (UIImage *)alteredImageFromSampleBuffer:(CMSampleBufferRef)sampleBuffer | |
{ | |
// Get a reference to the buffer, lock the address, and get a pointer to its data. Easy peasy. | |
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); | |
CVPixelBufferLockBaseAddress(imageBuffer, 0); | |
void *sourceData = CVPixelBufferGetBaseAddress(imageBuffer); | |
// Set a bunch of variables we need. The "radius" for the blur kernel needs to be positive and odd. The permute map maps the BGRA channels of the buffer to the ARGB that vImage needs. | |
size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer); | |
size_t width = CVPixelBufferGetWidth(imageBuffer); |
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; |
#define NSNullObjects @[@"",@0,@{},@[]] | |
@interface NSNull (InternalNullExtention) | |
@end | |
@implementation NSNull (InternalNullExtention) | |
MPMusicPlayerController* player = [MPMusicPlayerController iPodMusicPlayer]; | |
//get now playing item | |
if (player.playbackState == MPMusicPlaybackStatePlaying) { | |
MPMediaItem*item = [player nowPlayingItem]; | |
NSLog(@"playing %@",[item valueForProperty:MPMediaItemPropertyTitle]); | |
} |
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]; |