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
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
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
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
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
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.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
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
let g (a: decimal<m>) (b: decimal<m>):decimal<m^2> = (a*a + b*b) / 2m |
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 RoundM3 (cubic:decimal<m^3>): decimal<m^3> = Math.Round(cubic * 1m<m^-3>,10)*1m<m^3> | |
let VolumeAIsBEqualssquare((a:decimal<m>), (h:decimal<m>)) = | |
RoundM3 (V h a a) = RoundM3( a * a * h ) | |
let twoDecimals = Arb.generate<decimal<m>> |> Gen.suchThat ((<) 0m<m>) |> Gen.suchThat ((>) 1000000m<m>) |> Gen.two |> Arb.fromGen | |
Check.Quick (Prop.forAll twoDecimals VolumeAIsBEqualssquare) |