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; | |
using System.Linq; | |
using System.Collections.Generic; | |
class Program | |
{ | |
static IEnumerable<string> TakeReadLine(int count) | |
{ | |
for (int i = 0; i < count; i++) |
module ThinkingTemplate =
open System.Runtime.CompilerServices
open Avalonia
open Avalonia.Controls
open Avalonia.Controls.Shapes
open Avalonia.Controls.Primitives
open Avalonia.Controls.Templates
open Avalonia.Media
open Avalonia.Layout
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
module Domain | |
#load "DomainHelper.fsx" | |
open DomainHelper | |
open System | |
/// constrained to be not null and at most 50 chars | |
type String50 = private String50 of string | |
type ValidatedString50 = Validated<string, String50, string> |
データ参考 https://youtu.be/jAxRSFOSTd8
F#のような関数型プログラミングの作法で考えるとわかりやすい。
レコードの仕様はF#の匿名レコードに近い。 &演算子で更新可能。
let myRecord = {| X = 1; Y = 2; Z = 3 |}
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
type Car = { | |
model: string | |
name: string | |
speed: 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
using namespace System | |
using namespace System.Threading.Channels | |
using namespace System.Threading.Tasks | |
using namespace System.Management.Automation | |
filter pipe { | |
param( | |
$f, | |
$optArgs=@() | |
) |
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
Register-ArgumentCompleter -CommandName Foo -ScriptBlock { | |
4..0 | |
} -Native | |
TabExpansion2 "Foo 2" | |
# Or... | |
$myParams =@{ | |
Native=$true | |
CommandName='Foo' |
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
# escape=` | |
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore | |
# Use server core as an installer container to extract PowerShell, | |
# As this is a multi-stage build, this stage will eventually be thrown away | |
FROM ${WindowsServerCoreRepo}:20H2 AS installer-env | |
ARG PS_VERSION=7.2.0-preview.4 | |
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip |
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
#Requires -Version 7.0 | |
#Requires -Module PSParseHTML | |
using namespace System.Management.Automation | |
Import-Module PSParseHTML | |
# MSDNのHTMLを取得 | |
$rest = Invoke-RestMethod 'https://docs.microsoft.com/en-us/dotnet/api/system.text.encoding?view=net-5.0#remarks' | |
# 目的のテーブルを取得 |
NewerOlder