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 / detect-ie.js
Last active September 21, 2017 17:59 — forked from padolsey/gist:527683
Javascript: Detect IE without user-agent sniffing
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@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
@ksmandersen
ksmandersen / JSONFixture
Created April 8, 2014 16:42
Load JSON fixture files for your XCTests
@interface JSONFixture : NSObject
+ (id)fixtureDataWithName:(NSString *)fixtureName;
@end
@implementation JSONFixture
+ (id)fixtureDataWithName:(NSString *)fixtureName {
@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
@ksmandersen
ksmandersen / gist:4d3530eeacd9c41786e5
Created August 4, 2014 09:24
Workaround for: Generic Array DataSource
public class ArrayDataSource<CellType: UIView, ItemType> {
private var items: [ItemType]
private var cellReuseIdentifier: String
private var configureClosure: (CellType, ItemType) -> Void
private var proxy: DataSourceProxy!
private unowned var view: UIView
public init(view: UIView, items: [ItemType], cellReuseIdentifier: String, configureClosure: (CellType, ItemType) -> Void) {
self.items = items
self.cellReuseIdentifier = cellReuseIdentifier
//
// 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
}