Skip to content
View Enum Example.swift
enum Router: URLRequestConvertible {
static let baseURLString = "http://dev.example.com"
static var OAuthToken: String?
case MapView(Int)
case PhotoInfo(Int, ImageSize)
case Comments(Int, Int)
var URLRequest: NSURLRequest {
let (path: String, parameters: [String: AnyObject]) = {
View gist:55e75827a6b795e4507d
class ObserverSetEntry<Parameters> {
weak var object: AnyObject?
let f: AnyObject -> Parameters -> Void
init(object: AnyObject, f: AnyObject -> Parameters -> Void) {
self.object = object
self.f = f
}
}
View choose.vim
" find file in git repo
function! ChooseFile()
let dir = expand("%:h")
if empty(dir) | let dir = getcwd() | endif
let root = system("cd " . dir . " && git rev-parse --show-toplevel")
if v:shell_error != 0 | echo "Not in a git repo" | return | endif
let root = root[0:-2]
let selection = system("cd " . root . " && git ls-files -co --exclude-standard | choose")
View first.swift
var L = luaL_newstate()
luaL_openlibs(L)
luaL_loadstring(L, ("return function(x,y) return x + y end" as NSString).UTF8String)
lua_callk(L, 0, 1, 0, nil)
lua_pushnumber(L, 23)
lua_pushnumber(L, 45)
lua_callk(L, 2, 1, 0, nil)
var x = lua_tonumberx(L, -1, nil)
Something went wrong with that request. Please try again.