Skip to content

Instantly share code, notes, and snippets.

View jeremyabbott's full-sized avatar
🧙‍♂️
F# all day

Jeremy Abbott jeremyabbott

🧙‍♂️
F# all day
View GitHub Profile
let imageController id = controller {
show (fun ctx imageId -> (sprintf "Edit handler - id: %s; imageId %s" id imageId ) |> Controller.text ctx)
}
let topRouter = router {
forwardf "/%s/images" imageController
}
let app = application {
pipe_through endpointPipe
@jeremyabbott
jeremyabbott / removeDotnetSdksRuntimes.sh
Last active April 28, 2019 08:19
Remove old .NET Core versions
# dotnet --list-sdks # output looks like
# 2.1.500 [/usr/local/share/dotnet/sdk]
# awk '{print $2"/"$1}' # takes each line from stdin and prints out the 2nd column then "/" then the first column
# this gives us [/usr/local/share/dotnet/sdk]/2.1.500
# sed 's/\]//' # replaces the first ']'. ']' has to be escaped with \
# sed 's/\[//' # replaces the first '['. '[' has to be escaped with \
# grep -Ev '2\.2\.102' # matches on 2.2.102 which was the latest SDK installed
# -E # enables extended regular expression syntax
# -v # inverts the match. So return anything that doesn't match
# xargs # allows us to pass standard in as an argument to rm -rf
@jeremyabbott
jeremyabbott / setupfsharp.sh
Created March 16, 2019 20:57
LinuxFSharpGist
# Register Microsoft key and feed
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
# Install the .NET SDK
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2
@jeremyabbott
jeremyabbott / paketnotes.md
Last active August 2, 2018 15:14
Paket Notes

Paket Notes

Useful commands

Add source credentials

paket config add-credentials <url> --username <name> --password <password> --verify

Add package to project

@jeremyabbott
jeremyabbott / fsharpFoundationBio.md
Last active May 9, 2018 23:56
2018 F# Board Nomination Bio

Jeremy Abbott

Twitter: @mrjabbott

Who I Am

I'm a software engineer currently working on providing deployment solutions for microservices via FAKE. I've been working with F# since 2014, which is also when I gave my first F# presentation. Since that time I've presented on various F# topics across the country including at Code on the Beach, Twin Cites Code Camp, .NET Fringe, Open F#, and F# Conf. I've also written for the F# Advent Calendar. I'm a co-organizer of the Portland F# User Group. In my "free time" I experiment with new F# projects, and occassionally (not often enough) contribute to F# OSS projects.

Prior to moving to Portland I was also the vice-president, then president, then technology officer for a Louisiana-based non-profit focused on LGBT activism.

@jeremyabbott
jeremyabbott / CEs.fsx
Created April 9, 2018 19:24
Long script with code from F# for fun and Profit Explaining how `let` works along with details on how CEs work
let log p = printfn "expression is %A" p
let loggedWorkflow =
let x = 42
log x
let y = 43
log y
let z = x + y // block following let is unfinished. Every expression must return something.
log z
//return
z
@jeremyabbott
jeremyabbott / LongAsyncTask
Created April 6, 2018 14:39
Async workflow to start something and come back to it later
let now () = System.DateTime.Now
let someOtherWork times = async {
let rec inner' times current = async {
if times = current then
printfn "someOtherWork FINISHED"
else
do! Async.Sleep 1000
let next = current + 1
printfn "someOtherWork step %d @ %s" next (now() |> string)
@jeremyabbott
jeremyabbott / FirebaseFableFindings.fs
Last active December 31, 2017 16:48
Firebase bindings for Fable
// ts2fable 0.5.2
module rec Firebase
open System
open Fable.Core
open Fable.Import.JS
type [<AllowNullLiteral>] IExports =
abstract EmailAuthProvider: EmailAuthProviderStatic
abstract EmailAuthProvider_Instance: EmailAuthProvider_InstanceStatic
@jeremyabbott
jeremyabbott / understandingApply.fsx
Last active December 2, 2016 21:52
I think I get apply (finally)
(*
I think I understand apply!
Apply is a function that takes an elevated multi parameter functions and partially applies it for you.
*)
//For example:
// usage: printfn "%s" <| sayGood "morning" "Clément"
let sayGood = sprintf "Good %s %s" // string -> string -> string
type Result<'a> =
| Success of 'a
| Failure of string
let parseInt x =
try
System.Int32.Parse(x) |> Success
with ex -> ex.Message |> Failure
parseInt "hello"