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
/// Scan current video frame for a valid QR code containing customer id, returning it if found. | |
fn process_frame(&self) -> anyhow::Result<Option<i32>> { | |
// Get necessary elements | |
let video = self | |
.ref_video | |
.cast::<HtmlVideoElement>() | |
.ok_or(anyhow!("Video required"))?; | |
let context = self.context.as_ref().ok_or(anyhow!("Context required"))?; | |
let (width, height) = self.camera_dim; | |
// Draw frame to canvas |
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
open System | |
open FSharpPlus | |
open FSharpPlus.Data | |
module Person= | |
type Name = { unName : String } | |
with static member create s={unName=s} | |
type Email = { unEmail : String } | |
with static member create s={unEmail=s} | |
type Age = { unAge : int } |
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
type Email private (email : string) = | |
member __.Email = email | |
static member create(email : string ) = | |
// Some validation on email | |
Email (email) |
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
type Email = private | Email of string | |
module Email = | |
let create(email : string ) = | |
// Some validation on email | |
Email email | |
let value (Email email) = email |
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
type Person = { | |
FirstName : string | |
LastName : string | |
} | |
with | |
member x.FullName() = | |
x.FirstName + " " + x.LastName |
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
type Person(firstName:string, lastName: string) = | |
let firstName = firstName | |
let lastName = lastName | |
let calculateFullName() = | |
firstName + " " + lastName | |
member x.FirstName with get() = firstName | |
member x.LastName with get() = lastName | |
member x.FullName with get() = calculateFullName() |
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
class Person { | |
private readonly string firstName; | |
private readonly string lastName; | |
public Person(string firstName, string lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
public string FirstName { get {return this.firstName; } } | |
public string LastName { get {return this.lastName; } } |
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
#r "../../../bin/lib/net45/FSharp.Data.dll" | |
#load "../../../packages/test/FSharp.Charting/FSharp.Charting.fsx" | |
open FSharp.Data | |
open FSharp.Charting | |
type WorldBank = WorldBankDataProvider<"World Development Indicators", Asynchronous=true> | |
let wb = WorldBank.GetDataContext() |
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
.flex-container { | |
display: flex; | |
flex-wrap: nowrap; | |
background-color: DodgerBlue; | |
} | |
.flex-container > div { | |
background-color: #f1f1f1; | |
width: 100px; | |
margin: 10px; |
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
<h1>{{title}}</h1> | |
<h2>My favorite hero is: {{myHero.name}}</h2> | |
<p>Heroes:</p> | |
<ul> | |
<li *ngFor="let hero of heroes"> | |
{{ hero.name }} | |
</li> | |
</ul> | |
<p *ngIf="heroes.length > 3">There are many heroes!</p> |
NewerOlder