Skip to content

Instantly share code, notes, and snippets.

View sayurin's full-sized avatar

Kurata Sayuri sayurin

  • Japan
  • 06:30 (UTC +09:00)
View GitHub Profile
#nowarn "9"
namespace Sayuri.IO.Compression
open System.IO.Compression
open System.Reflection
type ZLibOption = {
CompressionLevel : int // -1, 0 .. 9
WindowBits : int // (8), 9 .. 15
MemLevel : int // 1 .. 9
CompressionStrategy : int // 0, 1 .. 4
@sayurin
sayurin / a.cs
Created April 11, 2019 23:23 — forked from yuka1984/a.cs
わかんないやつ
public interface EntityBase {
string Name { get; }
}
public abstract class RepositoryBase<T> where T : EntityBase, new() {
private readonly string _name;
public RepositoryBase() {
_name = new T().Name;
}
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\> Get-Date; -join (Get-Date); -join ,(Get-Date)
2018年9月27日 16:13:06
09/27/2018 16:13:06
2018/09/27 16:13:06
struct Base {
virtual ~Base() = default; // ... A
~Base() = default; // ... B
};
struct Derived : Base {
~Derived() = default; // ... a
virtual ~Derived() = default; // ... b
~Derived() override = default; // ... c
};
@sayurin
sayurin / Dialog.h
Last active December 4, 2017 23:42
#pragma once
#include <array>
#include <type_traits>
#include <Windows.h>
#include <windowsx.h>
template<int... controls>
struct Controls;
template<class RightAnchoredControls, class BottomAnchoredControls, class StretchingControls>
@sayurin
sayurin / dict.fs
Created December 26, 2016 09:34
dict関数のコンピュテーション式バージョン。一旦 seq<key, value> 型に変換せずに直接 Dictionay<key, value> を作成する。
open System
open System.Collections.Generic
type State<'Key, 'Value when 'Key : equality> =
| Dict of Dictionary<'Key, 'Value>
| Item of 'Key * 'Value
| Empty
type DictBuilder<'Key, 'Value when 'Key : equality> (equalityComparer : _ IEqualityComparer) =
let create () = Dictionary<'Key, 'Value> equalityComparer
module Program =
let rec Main args =
let numbers : obj[] =
[| 0b1; 0b10; ([| 0b100; 0b1000 |] : obj[]); // binary literals
0b10000; 0b100000 |] // digit separators: not supported
let sum, count = Tally(numbers) // deconstruction
printfn "Sum: %d, Count: %d" sum count
and Tally (values : obj[]) = // tuple types
let mutable r = 0, 0 // tuple literals
#pragma once
#include <future>
#ifdef USE_AWAIT
#include <experimental/resumable>
#include <boost/asio/use_future.hpp>
#else
#include <exception>
#include <memory>
#include <type_traits>
#include <utility>
@sayurin
sayurin / tinyBase64Decoder.fs
Last active June 29, 2016 22:25 — forked from alphaKAI/tinyBase64Decoder.fs
Tiny Base64 Decoder in F#
module tinyBase64Decoder
open System
open System.Collections.Generic
// Declare fundamental functions
// Generate n length Integer List (0 upto n - 1)
let iota n = [0..n-1]
// Generate n length List of x
@sayurin
sayurin / GridViewSort.cs
Created September 10, 2014 14:11
Automatically sort library for WPF ListView (GridView).
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
namespace Sayuri.Windows {
public static class GridViewSort {
class SortIcon : Adorner {