Skip to content

Instantly share code, notes, and snippets.

@kiwipom
kiwipom / enum.parse
Last active August 29, 2015 14:05
Filed under "huh"...
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var p1 = EnumParse<SequentialStates>("Ready, Going");
@kiwipom
kiwipom / declarative.vs.imperative.md
Last active August 29, 2015 14:01
The difference between declarative and imperative - With one trivial example

The difference between declarative and imperative

I sometimes like to ask the following simple interview question:

Write a function that will give me the sum of the squares of the odd numbers between 1 and 50

I like watching people go through the process of solving this simple problem - I think it initiates good conversations. More often than not, I will end up looking at code that in some shape or form resembles this:

Matt and Sal are in town!

Let's go out for a swift beverage and a bite to eat... (partners welcome!)

After work

Brew on Quay

then at

@kiwipom
kiwipom / adding-numbers.hs
Last active December 24, 2015 09:18
Adding numbers without using operators in haskell
-- Based on the c implementation, as per: http://stackoverflow.com/a/365544
import Data.Bits
add' :: (Bits a) => a -> a -> a
add' a b
| a == 0 = b
| otherwise = add' ((a .&. b) `shiftL` 1) (a `xor` b)
@kiwipom
kiwipom / gist:5417410
Last active December 16, 2015 10:08
Moq doesn't verify the mapper gets invoked within a .Select method
public class TheTest
{
[TestMethod]
public void TestThisThing()
{
var mockMapper = new Mock<IMapper>();
var mockDataAccess = new Mock<IDataAccess>();
var repositoryUnderTest = new Repository(mockMapper.Object);
// Create 2 data entities