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
# | |
# Given a json file creates files with each file having a different property or element set to null. | |
# Useage: | |
# Nullify -sourceFile "C:\afolder\afile.json" -targetPath "C:\anotherfolder" | |
# | |
Function Nullify { | |
Param( | |
[Parameter(Mandatory=$true, HelpMessage="The source file.")][string]$sourceFile, ` | |
[Parameter(Mandatory=$true, HelpMessage="The target path to write the output files to.")][string]$targetPath ) |
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
// F# solution to the biggest puddle problem posed at | |
// http://geekswithblogs.net/BlackRabbitCoder/archive/2015/04/07/little-puzzlersndashlargest-puddle-on-a-bar-chart.aspx | |
// April 2015 | |
// This solution works in one pass of the array | |
open System | |
let heights = [|10; 20; 80; 70; 60; 90; 40; 30; 40; 70|] | |
//let heights = [|10; 5; 10; 4; 5; 10|] | |
//let heights = [|0; 20; 80; 70; 60; 90; 40; 30; 40; 70|] |
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
// F# solution to the biggest puddle problem posed at | |
// http://geekswithblogs.net/BlackRabbitCoder/archive/2015/04/07/little-puzzlersndashlargest-puddle-on-a-bar-chart.aspx | |
// April 2015 | |
// this version will use three passes | |
open System | |
let heights = [|10; 20; 80; 70; 60; 90; 40; 30; 40; 70|] | |
type state1 = {Height:int; MaxLeft:int} |
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 FSharpKoans | |
open FSharpKoans.Core | |
//--------------------------------------------------------------- | |
// Apply Your Knowledge! | |
// | |
// Below is a list containing comma separated data about | |
// Microsoft's stock prices during March of 2012. Without | |
// modifying the list, programatically find the day with the | |
// greatest variance between the opening and closing price. |
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
using System.Diagnostics; | |
using StackExchange.Profiling; | |
namespace PSL.Web.Infrastructure | |
{ | |
//Needs web.config entry | |
//<add name="TraceToMiniProfiler" type="PSL.Web.Infrastructure.MiniProfilerTraceListener, theassemblyname" initializeData="" /> | |
public class MiniProfilerTraceListener : TraceListener | |
{ |
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
// Example of using F# MailboxProcessor against an HTML5 WebSocket (in Google Chrome) | |
// taken from http://v2matveev.blogspot.com/2010/04/mailboxprocessors-practical-application.html | |
// and then modified to work with the revised WebSocket protocol that includes a set of challenge bytes. | |
// The main changes are in the handshake function. | |
// Have a look at the http://nugget.codeplex.com for example WebSocket code in C#, on which I based the | |
// challenge processing code. | |
open System | |
open System.IO | |
open System.Linq |