Skip to content

Instantly share code, notes, and snippets.

@SilkyFowl
SilkyFowl / AvaloniaApiListv11ForFuncUI.md
Last active May 14, 2024 09:19
Avalonia and Avalonia.DataGrid v11.0.0 public API list for FuncUI bindings implementation.
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static IEnumerable<string> TakeReadLine(int count)
{
for (int i = 0; i < count; i++)
@SilkyFowl
SilkyFowl / Thinking-FuncUI-ControlTemplate.md
Created June 22, 2022 02:09
Exploring how to describe TemplatedContact in FuncUI. Next issue is what happens when ContentPresenter etc. are interpreted in Component
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
@SilkyFowl
SilkyFowl / Domain.fsx
Last active March 17, 2022 00:05
Thinking Domain......
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>
@SilkyFowl
SilkyFowl / M言語も使いつつPower Queryで神エクセルをなんとかしよう.md
Last active November 18, 2021 12:42
Power Queryで神エクセルをなんとかしよう。

データ参考 https://youtu.be/jAxRSFOSTd8

F#のような関数型プログラミングの作法で考えるとわかりやすい。

レコードの仕様はF#の匿名レコードに近い。 &演算子で更新可能

let myRecord = {| X = 1; Y = 2; Z = 3 |}
@SilkyFowl
SilkyFowl / PsFsharpTest.fsx
Last active November 16, 2021 08:21
Test Fharp for Powershell
type Car = {
model: string
name: string
speed: int
}
@SilkyFowl
SilkyFowl / test.ps1
Last active November 15, 2021 08:45
using namespace System
using namespace System.Threading.Channels
using namespace System.Threading.Tasks
using namespace System.Management.Automation
filter pipe {
param(
$f,
$optArgs=@()
)
@SilkyFowl
SilkyFowl / Completer.Simple.ps1
Last active November 13, 2021 11:26
Thinking Powershell Completer
Register-ArgumentCompleter -CommandName Foo -ScriptBlock {
4..0
} -Native
TabExpansion2 "Foo 2"
# Or...
$myParams =@{
Native=$true
CommandName='Foo'
@SilkyFowl
SilkyFowl / Dockerfile
Created April 12, 2021 13:35
windows contaner Server Coreでneovim
# 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
@SilkyFowl
SilkyFowl / ExtendEncodingArgs.ps1
Last active July 18, 2020 04:51
Powershell7.xのEncodingパラメータを拡張するスクリプト
#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'
# 目的のテーブルを取得