Skip to content

Instantly share code, notes, and snippets.

View nielswh's full-sized avatar

Niels Hansen nielswh

View GitHub Profile
@nielswh
nielswh / DropdownUtilityCell
Created December 4, 2012 23:29
Creating a dropdown Utility for TableViewCell
//
// TweetbotViewController.m
// testingTweetbotCell
//
// Created by Niels Hansen on 12-12-04.
// Copyright (c) 2012 Niels Hansen. All rights reserved.
//
#import "TweetbotViewController.h"
#import "TweetbotInfoCell.h"
@andyhd
andyhd / maybe-monad.js
Created January 16, 2012 01:02
Maybe monad in Javascript
function maybe(value) {
var obj = null;
function isEmpty() { return value === undefined || value === null }
function nonEmpty() { return !isEmpty() }
obj = {
map: function (f) { return isEmpty() ? obj : maybe(f(value)) },
getOrElse: function (n) { return isEmpty() ? n : value },
isEmpty: isEmpty,
nonEmpty: nonEmpty
}