Skip to content

Instantly share code, notes, and snippets.

✈️
On leave

Geoffrey Huntley ghuntley

✈️
On leave
View GitHub Profile
@ghuntley
ghuntley / TodoMVC.purs
Created Jun 9, 2020
PureScript implementation of WebCheck frontend language
View TodoMVC.purs
module TodoMVC where
import DSL
import Data.Array (filter, head, last)
import Data.Array as Array
import Data.Foldable (length)
import Data.Maybe (Maybe(..))
import Data.Number as Number
import Data.String (Pattern(..), split)
@ghuntley
ghuntley / cliff-notes.md
Created Jul 28, 2018 — forked from shiftkey/cliff-notes.md
Working Distributed - Cliff Notes
View cliff-notes.md
@ghuntley
ghuntley / TheDateTime.cs
Created May 3, 2018 — forked from glennstephens/TheDateTime.cs
If you have an app that is designed to be used over a long period of time (say a year). To write tests you need to simulate the passage of time. I've been using this little helper to allow to simulated tests in the fourth dimension
View TheDateTime.cs
// Instead of using calls like DateTime.Now, use TheDateTime.Now instead. In your production code it will default to using
// the read details and for testing you would make calls like:
// TheDateTime.SwitchToMockDate(new DateTime(2018, 12, 3);
// and then test what the outcome would be. It assumes that you have this throughout
public static class TheDateTime
{
static Lazy<LiveDateTimeFunctions> _liveDates = new Lazy<LiveDateTimeFunctions>(() => new LiveDateTimeFunctions());
static Lazy<MockDateTimeFunctions> _mockDates = new Lazy<MockDateTimeFunctions>(() => new MockDateTimeFunctions());
static IDateTimeFunctions _instance = _liveDates.Value;
@ghuntley
ghuntley / demo.sh
Created Oct 9, 2017 — forked from agc93/demo.sh
Script used for demos and live coding
View demo.sh
# This is pretty trimmed down, but is the basic idea, at least
docker ps -a -q -f status=exited | xargs -r docker rm
git reset --hard
git checkout stage-$1
View raspberry-pi-vpn-router.md

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@ghuntley
ghuntley / AppPickerExtensions.cs
Created Jun 28, 2017 — forked from richseviora/AppPickerExtensions.cs
Xamarin UI Test Date/Time Picker Extensions
View AppPickerExtensions.cs
// Tested with Xamarin.UITest V1.3.7;
using System;
using Xamarin.UITest;
namespace {APPNAMEHERE}.UITests
{
/// <summary>
/// This extension class extends the <see cref="IApp"/> interface to add extension methods for selecting values from the default Date/Time pickers in iOS and Android.
/// </summary>
public static class AppPickerExtensions
@ghuntley
ghuntley / PureIO.cs
Created Mar 14, 2017 — forked from tonymorris/PureIO.cs
A demonstration of pure-functional I/O using the free monad in C#
View PureIO.cs
using System;
namespace PureIO {
/*
C# does not have proper sum types. They must be emulated.
This data type is one of 4 possible values:
- WriteOut, being a pair of a string and A
- WriteErr, being a pair of a string and A
- readLine, being a function from string to A
@ghuntley
ghuntley / ExampleUsage.cs
Created Aug 18, 2016 — forked from NickCraver/ExampleUsage.cs
Code to mark a SQL string before it's passed to Dapper.
View ExampleUsage.cs
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
{
using (db.Connection.EnsureOpen())
{
try
{
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
}
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
{
@ghuntley
ghuntley / Build.xml
Created May 3, 2016 — forked from NickCraver/Build.xml
Stack Overflow Build Reference Docs
View Build.xml
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="PrepareStaticContent" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Passed in Parameters -->
<configuration></configuration>
<workingDir></workingDir>
<buildNumber></buildNumber>
<buildViews>false</buildViews>
<minifyJs>true</minifyJs>
<TargetsDirectory></TargetsDirectory>
@ghuntley
ghuntley / FilesystemWatchCache.cs
Created Apr 5, 2016 — forked from anaisbetts/FilesystemWatchCache.cs
An Rx-friendly Filesystem Watcher
View FilesystemWatchCache.cs
using System;
using System.IO;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI;
namespace SaveAllTheTime.Models
{
interface IFilesystemWatchCache
{
You can’t perform that action at this time.