This file contains hidden or 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
let VolumeA0IsPyramid ((h:decimal<m>), (b:decimal<m>)) = | |
RoundM3(V h 0m<m> b) = RoundM3( b * b * h / 3m ) | |
Check.Quick (Prop.forAll twoDecimals VolumeA0IsPyramid) |
This file contains hidden or 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; | |
using System.IO; | |
using System.Text; | |
namespace AllCapsMiddleware | |
{ | |
class CapsStream: Stream | |
{ | |
private readonly Stream _stream; | |
private readonly Decoder _decoder; |
This file contains hidden or 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; | |
using System.IO; | |
using System.Text; | |
namespace HelloWorldMiddleWare2 | |
{ | |
class CapsStream: Stream | |
{ | |
private Stream _stream; |
This file contains hidden or 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; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using Microsoft.Owin; | |
namespace AllCapsMiddleware | |
{ | |
using AppFunc = Func<IDictionary<string,object>, Task>; | |
public class AllCaps | |
{ |
This file contains hidden or 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
public class Startup | |
{ | |
public void Configuration(IAppBuilder appBuilder) | |
{ | |
HttpConfiguration config = new HttpConfiguration(); | |
config.MapHttpAttributeRoutes(); | |
appBuilder.Use<AllCapsMiddleware.AllCaps>(); | |
appBuilder.UseWebApi(config); | |
} | |
} |
This file contains hidden or 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
public async Task Invoke(IDictionary<string, object> env) | |
{ | |
var ctx = new OwinContext(env); | |
var accepts = ctx.Request.Accept; | |
if (accepts != null && accepts == accepts.ToUpper()) | |
{ | |
ctx.Response.Body = new CapsStream(ctx.Response.Body); | |
} | |
await next(env); | |
} |
This file contains hidden or 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
sPort := SerialPort new. | |
sPort baudRate: 57600. | |
sPort close. | |
sPort openPort: '/dev/ttyAMA0'. | |
sPort nextPutAll: '#PR010G255B255T001'. |
This file contains hidden or 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 FDK.SmsSender | |
open PSWinCom.Gateway.Client; | |
open Model; | |
open log4net.Ext.EventID; | |
type ISmsService = | |
abstract member SendSms: recieverNumber: string -> body: string -> unit | |
type UnknownError = { Error: string} |
This file contains hidden or 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
let ``In Western Christianity, using the Gregorian calendar, Easter always falls on a Sunday between 22 March and 25 April inclusive``(date: DateTime) = | |
let easter = EasterDay date.Year | |
let firstPossibleDay = new DateTime(date.Year, 3, 22) | |
let lastPossibleDay = new DateTime(date.Year, 4, 25) | |
easter >= firstPossibleDay && easter <= lastPossibleDay && easter.DayOfWeek = DayOfWeek.Sunday |
This file contains hidden or 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 ant | |
// The position is a x-y coordinate | |
type Pos = int*int | |
// The set of all points on the board which are black | |
type Blacks = Set<Pos> | |
type Dir = Right | Up | Left | Down | |
// This is the entire game state in one turn | |
type State = Pos * Dir * Blacks |