Skip to content

Instantly share code, notes, and snippets.

View cameronpresley's full-sized avatar

Cameron Presley cameronpresley

View GitHub Profile
public static class FunctionExtensions
{
public static Func<T2> Apply<T1, T2>(this Func<T1, T2> func, T1 input) => () => func(input);
public static Func<T2, T3> Apply<T1, T2, T3>(this Func<T1, T2, T3> func, T1 input) => x => func(input, x);
public static Func<T2, T3, T4> Apply<T1, T2, T3, T4>(this Func<T1, T2, T3, T4> func, T1 input) =>
(a, b) => func(input, a, b);
public static Action Apply<T1>(this Action<T1> action, T1 input) => () => action(input);
public static Action<T2> Apply<T1, T2>(this Action<T1, T2> action, T1 input) => a => action(input, a);
@scottgulliver
scottgulliver / checkout_branches.ps1
Created January 31, 2018 12:03
Powershell script to checkout all remote git branches
git branch -r | Select-String -Pattern "->" -NotMatch | Select-String -pattern "^ origin/" | foreach { $_ -replace '^ origin/', '' } | Foreach { git checkout $_ }
@cameronpresley
cameronpresley / mars_rover.elm
Last active May 8, 2018 11:16
Sample solution of Mars Rover kata
import Html exposing (div, button, text, h3, h2, input)
import Html.Events exposing (onClick, onInput)
import Html.Attributes exposing(..)
type Direction = North | South | East | West
type alias Location =
{ x: Int
, y: Int