Skip to content

Instantly share code, notes, and snippets.

View davidgrenier's full-sized avatar

David Grenier davidgrenier

View GitHub Profile
let numBuffers = 50
[1; 2; 3; 4; 5]
|> Seq.mapi (fun i x -> i, x)
|> Seq.groupBy (fun (i, _) -> i % numBuffers)
|> Seq.map (fun (_, group) -> group |> Seq.map snd |> Seq.toArray)
|> Seq.toArray
let bufferSize = 500
[1; 2; 3; 4; 5]
|> Seq.mapi (fun i x -> i, x)
type PagePath =
| [<Require(typeof<kendo.Resources.Culture.French>)>] FR
| [<Require(typeof<kendo.Resources.Culture.English>)>] EN
open System;
open System.Diagnostics;
[<EntryPoint>]
let main argv =
let rec cc amount coins =
match (amount, coins) with
| (0,_) -> 1
| (_,[]) -> 0
| (amount,_) when amount < 0 -> 0
open System;
open System.Diagnostics;
[<EntryPoint>]
let main argv =
let rec cc amount coins =
match (amount, coins) with
| (0,_) -> 1
| (_,[]) -> 0
| (amount,_) when amount < 0 -> 0
open System
open System.Diagnostics
let inline (|LessThan|_|) n = function
| x when x < n -> Some()
| _ -> None
let rec cc amount coins =
match amount, coins with
| 0, _ -> 1
@davidgrenier
davidgrenier / ExcelToId.fsx
Last active December 23, 2015 06:29
Convert Excel column to id
let columnNum =
let charValues =
['A'..'Z']
|> Seq.mapi (fun i c -> c, i + 1)
|> map
fun (code: string) ->
(Seq.toList code, (0,-1))
||> List.foldBack(fun v (depth, total) -> depth + 1, total + (pown 26 depth * charValues.[v]))
|> snd
#I @"C:\Bib\Projects"
#load @"Lib\Charting.fsx"
#r @"FSharp.Data\bin\FSharp.Data.dll"
open FSharp.Charting
open FSharp.Data
type Runs = CsvProvider<"""C:\Users\dgrenier\Desktop\race_data.csv""">
query {
@davidgrenier
davidgrenier / test.reg
Created August 19, 2013 14:48
VS 2012 Command Prompt Here
cmd.exe /k echo on & pushd "%1" & "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat" x64
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Line VS2012\command
@davidgrenier
davidgrenier / timeToLive.fsx
Last active December 21, 2015 01:09
Memoization with time to live
#r @"C:\Projects\FSharpx\Build\FSharpx.Core.dll"
#r @"C:\Projects\FSharpx\Build\FSharpx.Collections.Experimental.dll"
#r @"C:\Projects\ExtCore\ExtCore\bin\release\ExtCore.dll"
#r @"C:\Users\dgrenier\desktop\System.Collections.Immutable.dll"
open System
module Queue = FSharpx.Collections.Queue
module IntMap = FSharpx.Collections.Experimental.IntMap
module HashMap = ExtCore.Collections.HashMap
@davidgrenier
davidgrenier / Drilldown.txt
Created August 12, 2013 15:09
Disable VS Solution Explorer drill-down
Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0 and add a new dword value named UseSolutionNavigatorGraphProvider with a value of 0