Skip to content

Instantly share code, notes, and snippets.

Bryan Hunter bryanhunter

Block or report user

Report or block bryanhunter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bryanhunter / keybindings.json
Created Apr 20, 2018
VS Code User Settings
View keybindings.json
// Mac ~/Library/Application Support/Code/User/keybindings.json
"key": "alt+enter",
"command": "workbench.action.terminal.runSelectedText"
"key": "cmd+h",
"command": "editor.action.startFindReplaceAction"
bryanhunter / ColorNameTest.exs
Last active Mar 31, 2018
An example of property-based testing in Elixir 1.6
View ColorNameTest.exs
# Until StreamData ships in Elixir it needs to be added as a dependency.
# Add this to your mix.exs deps...
# {:stream_data, "~> 0.4.2"}
defmodule ColorNameTest do
use ExUnit.Case, async: true
use ExUnitProperties
bryanhunter / UnitsOfMeasure.fs
Created Nov 12, 2017
Union type with units of measure
View UnitsOfMeasure.fs
module UnitsOfMeasure
[<Measure>] type cm
[<Measure>] type inch
type Shape<[<Measure>]'u> =
| Circle of float<'u>
| Square of float<'u>
| Triangle of float<'u> * float<'u>
| Rectangle of float<'u> * float<'u>
View UnionTypes.fs
module UnionTypes
// Learn more about F# at
type Shape =
| Circle of float
| Square of float
| Triangle of float * float
| Rectangle of float * float
bryanhunter / bangpipe.exs
Last active Nov 12, 2017
BangPipe - a really silly Elixir macro
View bangpipe.exs
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> defmodule Bangpipe do
...(1)> defmacro left <|> right do
...(1)> quote do
...(1)> unquote(left)
...(1)> |> case do
...(1)> {:ok, val} -> val
...(1)> val -> val
...(1)> end
...(1)> |> unquote(right)
bryanhunter / HelloPhoenix.fsx
Created Dec 14, 2016
F# script that connects to Phoenix channels
View HelloPhoenix.fsx
// This sample shows connecting to a sample Phoenix chat application running locally.
// The sample Phoenix app was written by Chris McCord and can be found here:
// #r @".\packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll"
open WebSocketSharp
let ws = new WebSocket("ws://localhost:4000/socket/websocket")
ws.OnOpen.Add(fun args -> System.Console.WriteLine("Open"))
bryanhunter / bumper.exs
Created Jan 20, 2015
Example of Elixir and the bit-syntax to read a Bitmap image
View bumper.exs
defmodule Bumper do
@doc ~S"""
Reads a Bitmap (24-bit) and displays width, height, and the RGB of each pixel
def show(filename) do
{:ok, bindata} =
<< "BM",
bryanhunter / Handy.exs
Created Jan 11, 2015
Growing bag of handy short functions and one-liners in Elixir
View Handy.exs
# Show all Pids on local node with at least one message queued in its mailbox
Process.list |> Enum.filter(&([:message_queue_len] >0))
View ndclondon2014_fp_track
## Functional Track talks from NDC London 2014
### Wednesday 2014-12-3
* [F-Words - Functional Programming Terms With More Than Four Letters - Calvin Bottoms](
* [Reactive Game Development For The Discerning Hipster - Bodil Stokke](
* [Erlang Patterns Matching Business Needs -- Torben Hoffman](
* [Equivalence Classes,, FsCheck, Property-Based Testing -- Mark Seemann](
* [Functional programming design patterns -- Scott Wlaschin](
* [Write Your Own Compiler in 24 Hours -- Phillip Trelford](
View Makefile
# Copyright 2012 Erlware, LLC. All Rights Reserved.
# This file is provided to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain
# a copy of the License at
# Unless required by applicable law or agreed to in writing,
You can’t perform that action at this time.