Skip to content

Instantly share code, notes, and snippets.

View ohtwo's full-sized avatar
🌙
° ☾ ☆ ¸. ¸ ★ :.  . • ○ ° ★

Kang Byeonghak ohtwo

🌙
° ☾ ☆ ¸. ¸ ★ :.  . • ○ ° ★
View GitHub Profile
@ohtwo
ohtwo / NSDate+RFC3339.swift
Created November 19, 2015 06:49 — forked from algal/NSDate+RFC3339.swift
NSDate+RFC3339
extension NSDate {
var stringFormattedAsRFC3339: String {
return rfc3339formatter.stringFromDate(self)
}
class func dateFromRFC3339FormattedString(rfc3339FormattedString:String) -> NSDate?
{
/*
NOTE: will replace this with a failible initializer when Apple fixes the bug
that requires the initializer to initialize all stored properties before returning nil,
@ohtwo
ohtwo / dispatch_once.swift
Last active September 8, 2015 03:38 — forked from kristopherjohnson/dispatch_once.swift
Example of using dispatch_once() in Swift
import Foundation
var token: dispatch_once_t = 0
func test() {
dispatch_once(&token) {
println("This is printed only on the first call to test()")
}
println("This is printed for each call to test()")
}
//
// AppDelegate.swift
// pushtest
//
// Created by sawapi on 2014/06/08.
// Copyright (c) 2014年 sawapi. All rights reserved.
//
// iOS8用
import UIKit