Skip to content

Instantly share code, notes, and snippets.

Avatar

Jamie Dixon jamessdixon

View GitHub Profile
@jamessdixon
jamessdixon / gist:b351af631ad02853bb51f40086361c43
Created Jul 4, 2017
UWA for IoT targeting a RP2: Blinkey
View gist:b351af631ad02853bb51f40086361c43
public sealed partial class MainPage : Page
{
GpioPin _pin = null;
Int32 _pinValue = 0;
public MainPage()
{
this.InitializeComponent();
Loaded += MainPage_Loaded;
}
View gist:5a27cce3c1ab0b66386b81a156a7f69a
type Customer = {Name:string; Email:string}
type Input = {Customer:Customer; MaxNameLength:int}
type Result<'t> =
| Good of 't
| Bad of string
let bind switchFunction =
fun twoTrackInput ->
match twoTrackInput with
@jamessdixon
jamessdixon / Programmic NLog Example Using FSharp
Created Dec 29, 2016
Programmic NLog Example Using FSharp
View Programmic NLog Example Using FSharp
#r "../packages/NLog.4.4.1/lib/net45/NLog.dll"
open NLog
let config = new Config.LoggingConfiguration()
let target = new Targets.ColoredConsoleTarget("ConsoleTarget")
config.AddTarget(target)
let rule = new Config.LoggingRule()
@jamessdixon
jamessdixon / MakeDecemberTenAgain
Created Dec 22, 2016
New Day Of Year Based On A 10 Month Calendar
View MakeDecemberTenAgain
open System
let getNewDate dayOfYear =
["Jan";"Feb";"Mar";"Apr";"May";"Jun";"Sep";"Oct";"Nov";"Dec"]
|> Seq.mapi(fun i m -> if i%2=0 then m, [1..36] else m, [1..37])
|> Seq.map(fun (m,ad) -> ad |> Seq.map(fun d -> m,d))
|> Seq.collect(fun a -> a)
|> Seq.mapi(fun i d -> i, d )
|> Seq.tryFind(fun (i,d) -> i = dayOfYear)
@jamessdixon
jamessdixon / Age and Sex Analysis Of Microsoft USA MVPs
Created Dec 6, 2016
Age and Sex Analysis Of Microsoft USA MVPs
View Age and Sex Analysis Of Microsoft USA MVPs
#r "WindowsBase.dll"
#r "System.Net.Http.dll"
#r "PresentationCore.dll"
#r "../packages/FSharp.Data.2.3.2/lib/net40/FSharp.Data.dll"
open System
open System.IO
open System.Web
open System.Net
@jamessdixon
jamessdixon / TheCountedStateMap
Last active Aug 29, 2015
The Counted State Map
View TheCountedStateMap
the.counted <- read.csv("./Data/TheCountedWithGeo.csv")
summary(the.counted)
#http://stackoverflow.com/questions/13420700/r-ggplot2-ggmap-concentric-circles-as-points
library(ggplot2)
library(maps)
all.states <- map_data("state")
plot <- ggplot()
plot <- plot + geom_polygon(data=all.states, aes(x=long, y=lat, group = group),
@jamessdixon
jamessdixon / TAMGeoAndTheCounted
Created Jul 1, 2015
TAMGeoLocation and TheCounted Dataset
View TAMGeoAndTheCounted
#r "../packages/FSharp.Data.2.2.2/lib/net40/FSharp.Data.dll"
open System
open System.IO
open System.Text
open FSharp.Data
[<Literal>]
let geoLocationSample = "..\Data\TAMUHttpGet.json"
type GeoLocationServiceContext = JsonProvider<geoLocationSample>
@jamessdixon
jamessdixon / TAMGeolocationService
Created Jun 9, 2015
Texas A&M Geolocation Service in F#
View TAMGeolocationService
#r "../packages/FSharp.Data.2.2.2/lib/net40/FSharp.Data.dll"
open System.IO
open System.Text
open FSharp.Data
[<Literal>]
let sample = "..\Data\TAMUHttpGet.json"
type Context = JsonProvider<sample>
@jamessdixon
jamessdixon / ArtShowBizLogicChallenge
Created May 26, 2015
Art Show Business Logic Challenge Using FSharp
View ArtShowBizLogicChallenge
type Painting = {id:int;name:string;tags:string}
type ArtShow = {id:int;name:string;expectedAttendance:int;paintings:Painting list}
let painting0 = {id=0;
name="Starry Night";
tags="Impressionism;Nature"}
let painting1 = {id=1;
name="Sunday Afternoon on the Island of La Grande Jatte";
tags="Impressionism;Nature;LeisureActivities"}
let painting2 = {id=2;
@jamessdixon
jamessdixon / SendGridEmail
Created Apr 19, 2015
Send Grid Email in F#
View SendGridEmail
#r "~/packages/Sendgrid.5.1.0/lib/SendGridMail.dll"
#r "~/packages/SendGrid.SmtpApi.1.2.1/lib/net40/SendGrid.SmtpApi.dll"
open System
open System.Collections.Generic
open System.Net
open System.Net.Mail
open SendGrid