Skip to content

Instantly share code, notes, and snippets.

View boek's full-sized avatar
🔥
🦊

Jeff Boek boek

🔥
🦊
View GitHub Profile
func buildView<T: UIView>(closure: ((T) -> ())? = nil) -> T {
let view = T(frame: CGRectZero)
view.setTranslatesAutoresizingMaskIntoConstraints(false)
closure?(view)
return view
}
import Foo
typealias Bar = Foo.Bar
typealias Bars = [Foo.Bar]
protocol HTTPHandlerType {
typealias Data
/// :returns: true if the request was handled; false otherwise
func handle(request: HTTPRequest, data: Data) -> Bool
func foo(request: HTTPRequest, data: Data) -> Bool
}
class MyHandler : HTTPHandlerType {
# Add this to your .oh-my-zsh theme if you're using those, or directly to your zsh theme :)
# Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {