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
winrt::import!( | |
dependencies | |
os | |
modules | |
"windows.foundation" | |
"windows.system.power" | |
); | |
use windows::system::power::*; | |
fn battery_status() -> std::string::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
#r "nuget: Microsoft.Windows.Sdk.NET, 10.0.18362.3-preview" | |
open System | |
open Windows.Media | |
open Windows.Media.Core | |
open Windows.Media.Playback | |
open Windows.Storage | |
open Windows.Storage.FileProperties |
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 "nuget: Microsoft.Windows.Sdk.NET, 10.0.18362.3-preview" | |
open System | |
open Windows.Storage | |
let asyncGetFiles() = | |
async { | |
let! files = KnownFolders.MusicLibrary.GetFilesAsync().AsTask() |> Async.AwaitTask | |
return files |> Seq.take 5 | |
} |
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 "nuget: Suave" | |
// 👆🏽 this was added in F# 5.0 | |
// if you are using the .NET 5.0 previews or RC run as follows | |
// dotnet fsi suavefileexplorer.fsx --langversion:preview | |
open System | |
open System.IO | |
open System.Threading | |
open System.Text | |
open Suave |
- pick your installer at https://dotnet.microsoft.com/download/dotnet/5.0
- get ionide extension for VSCode https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-fsharp
- dotnet new console -lang F# -o MyFSharpConsole
- code MyFSharpConsole
optional
- Get Feliz Templates (React apps in F#)
dotnet new -i Feliz.Template::*
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
export interface ISwitchCameraArgs { | |
deviceId?: string | |
} | |
export interface IStartCameraArgs { | |
constraints?: MediaStreamConstraints; | |
retryCount?: number; | |
} | |
export interface ICameraDevice extends MediaDeviceInfo { |
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 ObjectIdConverter() = | |
inherit JsonConverter<ObjectId>() | |
override _.Read(reader: byref<Utf8JsonReader>, typeToConvert: Type, options: JsonSerializerOptions) = | |
ObjectId.Parse(reader.GetString()) | |
override _.Write(writer: Utf8JsonWriter, value: ObjectId, options: JsonSerializerOptions) = | |
writer.WriteStringValue(value.ToString()) |
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 "nuget: Mondocks.Net" | |
open System | |
open Mondocks.Queries | |
type UserParams = | |
{ name: string; age: int; } | |
let insertModel<'T> (collection: string) (values: seq<'T>) = | |
insert collection { | |
documents values |
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
#!/usr/bin/env -S dotnet fsi | |
#r "nuget: MongoDB.Driver" | |
#r "nuget: MongoDB.Driver.GridFS" | |
#r "nuget: Mondocks.Net" | |
#r "nuget: Spectre.Console" | |
open System | |
open System.IO | |
open Spectre.Console | |
open MongoDB.Driver |