Skip to content

Instantly share code, notes, and snippets.

View ksmandersen's full-sized avatar
🏠
Working from home

Kristian Andersen ksmandersen

🏠
Working from home
View GitHub Profile
@ksmandersen
ksmandersen / gist:72349811f5100d35c8a2
Last active August 29, 2015 14:04
Generic Array DataSource
class ArrayDataSource<CellType: UIView, ItemType>: NSObject, UITableViewDataSource, UICollectionViewDataSource {
var items: [ItemType]
var cellReuseIdentifier: String
var configureClosure: (CellType, ItemType) -> Void
init(items: [ItemType], cellReuseIdentifier: String, configureClosure: (CellType, ItemType) -> Void) {
self.items = items
self.cellReuseIdentifier = cellReuseIdentifier
self.configureClosure = configureClosure
//
// TableViewDataSource.swift
// QuickReply
//
// Created by Kristian Andersen on 31/07/14.
// Copyright (c) 2014 Robocat. All rights reserved.
//
import UIKit
ant
automake
brew-cask
coreutils
go
hub
libyaml
node
pkg-config
ruby
@ksmandersen
ksmandersen / swift_segfault
Last active August 29, 2015 14:15
Swift Segfault
case SomeEnum {
case A
case B
}
let someValue = SomeEnum.A
if someValue == .A {
// Do something
}
@ksmandersen
ksmandersen / index.html
Created January 30, 2013 17:19
html5-index.html
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
@ksmandersen
ksmandersen / .vimrc
Last active December 25, 2015 12:29
My new minimal vim config for learning vim as go
" ========= Initial setup ===========
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" backspace in insert mode works like normal editor
set backspace=2
syntax on " syntax highlighting
import UIKit
class GenericView: UIView {
let stackView = UIStackView()
init() {
super.init(frame: CGRectZero)
setup()
}
import UIKit
class GenericViewController: UIViewController {
var contentView: GenericView {
return view as! GenericView
}
init() {
super.init(nibName: nil, bundle: nil)
@ksmandersen
ksmandersen / RemoteImage.swift
Last active January 20, 2016 14:56
Loading a UIImage into a UIImageView from a NSURL using Forbind
import UIKit
import Forbind
import ForbindExtensions
enum LoadingState {
case NotSet
case Loading
case Loaded
}