This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r @"packages/FAKE/tools/FakeLib.dll" | |
open Fake | |
let lprunPath = @"C:\ProgramData\LINQPad\Updates50\510\lprun.exe" | |
type System.String with | |
static member Delimit delimiter (items:string seq) = | |
String.Join(delimiter,items |> Array.ofSeq) | |
module Proc = | |
// ExecProcess is a thin wrapper around Process.Start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// consider doing this in the Load or Window_ContentRendered events instead | |
// options to clean up temporary things like frontmost could be done in Window_Initialized | |
// using options from http://stackoverflow.com/questions/257587/bring-a-window-to-the-front-in-wpf | |
public new bool? ShowDialog() | |
{ | |
var t = new System.Threading.Tasks.Task(() => | |
{ | |
// wait for the window to show from show dialog | |
Task.Delay(1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// trying to learn computation expressions | |
//http://theburningmonk.com/2012/01/f-retry-workflow/ | |
#if LINQPAD // doesn't actually work right in linqpad, but conveys intention, hopefully | |
let dumpt (title:string) x = x.Dump(title); x | |
#else | |
let dumpt (title:string) x = printfn "%s:%A" title x; x | |
#endif | |
module AttemptBuilding = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// search code for sproc references and check that they exist in the db project | |
// consider three different joins, one with each as primary to find things that exist in one but not the other | |
// compiles and does exactly what is desired now | |
module Settings = | |
let debug = false | |
let slnRoot = Path.Combine(Environment.ExpandEnvironmentVariables("%devroot%"),"PracticeManagement","dev","PracticeManagement") | |
let startPath = slnRoot | |
let sqlProjDirectory = Path.Combine(slnRoot,"Db") //C:\TFS\PracticeManagement\dev\PracticeManagement\Db | |
let sqlProjectFile = | |
// let the finding of code references work even if the sql project file doesn't exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Suave is working! | |
// Learn more about F# at http://fsharp.org | |
// See the 'F# Tutorial' project for more help. | |
open System | |
open System.IO | |
open Suave | |
open Suave.Http | |
open Suave.Http.Applicatives | |
open Suave.Http.Successful |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
// in projectDir/.vscode | |
"version": "0.1.0", | |
"command": "cmd", | |
"isShellCommand": true, | |
"args": [ | |
"/C" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from https://github.com/gregoryyoung/m-r/blob/master/SimpleCQRS/CommandHandlers.cs | |
// actual code https://github.com/thinkbeforecoding/m-r/tree/FSharp/FsSimpleCQRS | |
module Commands = | |
//[<Abstract>] | |
type DeactivateInventoryItem = | |
{ | |
InventoryItemId: Guid | |
OriginalVersion: int // version I'm acting on, for checking to make sure my change only fires if the data the change was based on is still unchanged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Project.Schema | |
open System | |
open System.Runtime.CompilerServices | |
open System.Collections.Generic | |
// http://blogs.msdn.com/b/jaredpar/archive/2010/07/27/converting-system-func-lt-t1-tn-gt-to-fsharpfunc-lt-t-tresult-gt.aspx | |
[<Extension>] | |
type public FSharpFuncUtil = | |
[<Extension>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pm.Dal.AdoHelper | |
// desired features | |
// "do we have a connectionstring or connection?" ignorance-capable coding | |
// "are we in a transaction?" ignorance-capable coding | |
// massive reduction in using blocks necessary | |
// remove any reliance/requirement to refer directly to System.Data in layers that need not | |
// conventions: | |
// pascal cased functions if they are specially crafted to be easier for C# to consume |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BReusable | |
open System | |
open System.Text | |
let trim (s:string) = if isNull s then null else s.Trim() | |
let after (delimiter:string) (s:string) = s.Substring(s.IndexOf delimiter + delimiter.Length) | |
let before (delimiter:string) (s:string) = s.Substring(0,s.IndexOf delimiter) | |
let beforeI (delimiter:string) (s:string) = s.Substring(0,s.IndexOf(delimiter, StringComparison.CurrentCultureIgnoreCase)) | |
let capture (pattern:string) (s:string) = Regex.Match(s, pattern).Groups.[1].Value | |
let isNullOrEmptyToOpt s = if String.IsNullOrEmpty s then None else Some s |