Skip to content

Instantly share code, notes, and snippets.

View nolili's full-sized avatar
:octocat:

NORITAKA KAMIYA nolili

:octocat:
View GitHub Profile
@nolili
nolili / After
Created December 12, 2011 07:49
ARC
#import "ViewController.h"
#import <CoreMotion/CoreMotion.h>
@implementation ViewController
{
CMMotionManager *motionManager;
}
- (void)hoge
{
NSLog(@"hoge");
@nolili
nolili / gist:1506670
Created December 21, 2011 16:32
UIColorからR,G,B,Alphaの値を取得する
/*
UIColorからR,G,B,Alphaの値を取得する
iOS SDK 5.0 以降が必要
*/
// サンプルのUIColor
//[UIColor whitecolor]の場合カラースペースが異なるため取得できない
UIColor *color = [UIColor redColor];
// 取得した値を保存する変数
@nolili
nolili / gist:3174909
Created July 25, 2012 07:25 — forked from yusuke/gist:3174898
main.m
#import <Foundation/Foundation.h>
#import <stdio.h>
@interface RGB : NSObject
{
unsigned char red, green, blue;
}
- (id)initWithRed:(int)r green:(int)g blue:(int)b;
- (id)blendColor:(RGB *)color;
- (void)print;
@nolili
nolili / gist:4104270
Created November 18, 2012 08:33
NSLogの情報をサンドボックスにテキストファイルとして書き出す
- (void) redirectConsoleLogToDocumentFolder
{
//ログを出力する
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@"console.log"];
freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
NSLog(@"Start Logging");
//バージョン情報をログに出力
//
//
// Created by nori on 2012/12/21.
// Copyright (c) 2012年 nori. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIApplication(LoggerExtention)
+ (void)startLogging;
tell application "System Events"
tell current location of network preferences
set VPN to service "VPN"
if exists VPN then connect VPN
repeat while (current configuration of VPN is not connected)
delay 1
end repeat
end tell
end tell
tell application "System Events"
tell current location of network preferences
set VPN to service "VPN"
if exists VPN then disconnect VPN
end tell
end tell
@nolili
nolili / gist:2922de9635dcf946f427
Last active August 29, 2015 14:02
WWDC2014Music
Bastille – Pompeii
Jack White – Lazaretto
Beck – Gamma Ray
OneRepublic – Counting Stars
MGMT – Electric Feel
Sbtrkt – Wildfire (feat. Little Dragon)
Wilco – You Never Know
Mumford & Sons – I Will Wait
Gorillaz – Stylo (feat. Mos Def and Bobby Womack)
Daft Punk – Instant Crush
@nolili
nolili / gist:48fb7d1f81b6b54554a4
Created June 30, 2014 02:06
Swift C like array
// Array to NSData
var cArray:Array<UInt8> = [0x01, 0x02, 0x03]
var data = NSData(bytes:cArray, length:sizeof(UInt8) * cArray.count)
println(data)
// NSData to Array
var bufferArray:Array<UInt8> = [0x00, 0x00, 0x00]
data.getBytes(&bufferArray, length:3)
println(bufferArray)
// Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
class Counter:NSObject, NSCopying{
var count = 0;
func add(){