Skip to content

Instantly share code, notes, and snippets.

View jamessdixon's full-sized avatar

Jamie Dixon jamessdixon

View GitHub Profile
@jamessdixon
jamessdixon / WCPSSScoresAndAssignmentCrossWalk
Created February 27, 2015 17:29
Crosswalk table for WCPSS Scores and WCPSS Assignment Pyramid
#r "../packages/FSharp.Data.2.1.1/lib/net40/FSharp.Data.dll"
#r "../packages/Microsoft.Azure.Documents.Client.0.9.2-preview/lib/net40/Microsoft.Azure.Documents.Client.dll"
#r "../packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll"
#r "C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.5.1/System.Net.Http.dll"
open System
open System.IO
open FSharp.Data
open System.Linq
open Newtonsoft.Json
@jamessdixon
jamessdixon / WCPSSScoresAndTaxBase
Created February 28, 2015 14:02
WCPSS Scores and Tax Base Analysis Using R
#Create Wake County Scores From NC State Scores
WakeCountyScores <- NCScores[NCScores$District == 'Wake County Schools',]
#Join SchoolNameMatch to Wake County Scores
WakeCountyScores <- merge(x=WakeCountyScores, y=SchoolNameMatch, by.x="School", by.y="WCPSS")
#Join Property Values
WakeCountyScores <- merge(x=WakeCountyScores, y=SchoolValuation, by.x="Property", by.y="SchooName")
#Remove Property column
namespace Newtonsoft.Json.Converters
open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open System
type IdiomaticDuConverter() =
inherit JsonConverter()
[<Literal>]
@jamessdixon
jamessdixon / SendGridEmail
Created April 19, 2015 01:17
Send Grid Email in F#
#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
@jamessdixon
jamessdixon / ArtShowBizLogicChallenge
Created May 26, 2015 18:47
Art Show Business Logic Challenge Using FSharp
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 / TAMGeolocationService
Created June 9, 2015 01:31
Texas A&M Geolocation Service in F#
#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 / TAMGeoAndTheCounted
Created July 1, 2015 19:09
TAMGeoLocation and TheCounted Dataset
#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 / TheCountedStateMap
Last active August 29, 2015 14:24
The Counted State Map
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 / Age and Sex Analysis Of Microsoft USA MVPs
Created December 6, 2016 03:03
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 / MakeDecemberTenAgain
Created December 22, 2016 00:46
New Day Of Year Based On A 10 Month Calendar
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)