Skip to content

Instantly share code, notes, and snippets.

View tonymorris's full-sized avatar

Tony Morris tonymorris

View GitHub Profile
@tonymorris
tonymorris / polair42.md
Last active March 26, 2024 13:54
Polair42

Brisbane Police Helicopter

What is the helicopter's registration?

VH-NVK typically on squawk code 0042

What model is the helicopter?

It is a Eurocopter BO-105.

@tonymorris
tonymorris / lane-splitting.md
Created October 16, 2012 08:52
Lane-splitting

141 No overtaking etc to the left of a vehicle

  1. A driver (except the rider of a bicycle) must not overtake a vehicle to the left of the vehicle unless--
    • the driver is driving on a multi-lane road and the vehicle can be safely overtaken in a marked lane to the left of the vehicle; or
    • the vehicle is turning right, or making a U–turn from the centre of
    • the road, and is giving a right change of direction signal.
  2. The rider of a bicycle must not ride past, or overtake, to the left of a vehicle that is turning left and is giving a left change of direction signal.
  3. In this section--
  • "turning right" does not include making a hook turn.
@tonymorris
tonymorris / PureIO.cs
Last active April 2, 2022 16:23
A demonstration of pure-functional I/O using the free monad in C#
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
skipRight ::
(a -> [a] -> ([a] -> b) -> b)
-> b
-> [a]
-> b
skipRight _ z [] =
z
skipRight f z (h:t) =
f h t (skipRight f z)

Code of Conduct

Communication

Times
  • All times will be communicated in a way that is unambiguous. This communication may be a local time, with a UTC offset specified.

For example:

import Control.Applicative(Alternative(..), liftA2)
newtype ValidationT f a b =
ValidationT (f (Either a b))
instance Functor f => Functor (ValidationT f a) where
fmap f (ValidationT x) =
ValidationT (fmap (fmap f) x)
instance Applicative f => Applicative (ValidationT f a) where
#!/usr/bin/env runhaskell
module Main where
import Text.Printf(printf)
import Data.List(intercalate)
import Data.Bool (bool)
kg2lb =
(*2.2)
@tonymorris
tonymorris / main.hs
Created July 2, 2021 06:54 — forked from gregberns/main.hs
How to make a Foldable Instance with multiple parameters
import Data.Monoid
-- This code doesn't work...
-- How can you make a multi-parameter data type be Foldable?
-- foldMap over `a` so it can be converted to a Monoid
data BinaryTree3 a v
= Node3 a (BinaryTree3 a v) (BinaryTree3 a v)
| Leaf3 a v
deriving (Show)
#!/usr/bin/env runhaskell
import Text.Printf
fromRadian a = a / pi * 180
toRadian a = a / 180 * pi
showDiff :: Int -> String
showDiff x =
let x' = toRadian (fromIntegral x)
diff = fromRadian (x' - sin x')
#!/usr/bin/env runhaskell
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
import Data.Foldable
import Text.Printf
data Point a =
Point {