Skip to content

Instantly share code, notes, and snippets.

View nolili's full-sized avatar
:octocat:

NORITAKA KAMIYA nolili

:octocat:
View GitHub Profile
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@nolili
nolili / AsyncTests.swift
Created September 11, 2014 14:12
asynchronous unit test
import UIKit
import XCTest
class AsyncTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
@nolili
nolili / ViewController.swift
Created September 11, 2014 13:56
Counter-Swift
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var display: UILabel?
@IBAction func add(sender: UIButton) {
count++
}
@nolili
nolili / gist:2bf1a701df1015ed6488
Created August 23, 2014 23:53
SwiftのArray(バイト列)からNSDataへ変換
import UIKit
var str = "Hello, playground"
// Swiftの配列からNSDataへ変換
var rawArray:[UInt8] = [0x01, 0x02, 0x03];
let data = NSData(bytes: &rawArray, length: rawArray.count)
print(data)
// バイト列からNSDataに変換
@nolili
nolili / gist:122c5a524761dbbf613d
Last active August 29, 2015 14:05
Travis CI メモ
Travis CI メモ
オープンソース向けのCIツール
githubからソースをpull、スクリプトを動作させ、結果を通知する。
Xcodeのプロジェクトがビルドできる。(OS XのVMが走っている?未確認)
Publicリポジトリであれば無料。
https://travis-ci.org
Privateリポジトリを扱う場合は、有料のプラン契約が必要。
月額129USD(13000JPY程度)
for i in stride(from: 0, to: 100, by: 25){
// 0, 25, 50, 75
println(i)
}
for i in stride(from: 0, through: 100, by: 25){
// 0, 25, 50, 75, 100
println(i)
// Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
class Counter:NSObject, NSCopying{
var count = 0;
func add(){
@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)
@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
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