Skip to content

Instantly share code, notes, and snippets.

Matsushima, Kazuhiro Gab-km

Block or report user

Report or block Gab-km

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Gab-km
Gab-km / Get-FilesRecursively.ps1
Created Jan 19, 2017
再帰的にファイルのフルパス、サイズ、更新日時を表示するスクリプト
View Get-FilesRecursively.ps1
Get-ChildItem -Recurse | where { $_.Directory } | %{ [System.String]::Format("{0}`t{1}`t{2}", $_.FullName, $_.Length, $_.LastWriteTime) } | %{ Write-Output $_ }
@Gab-km
Gab-km / exceptionalParameterizedTest.fs
Last active Apr 27, 2016
例外が起こるかもしれないparameterizeなテスト
View exceptionalParameterizedTest.fs
let catch (expr: Lazy<'T>) =
try
Choice2Of2(expr.Force())
with
| ex -> Choice1Of2(ex)
let parameterizedTest(input, expected) = test {
let actual = catch (Lazy.Create <| fun () -> fut input)
match (expected, actual) with
| (Choice1Of2 ex, Choice1Of2 ex') ->
@Gab-km
Gab-km / assertSeqEquals.fs
Last active Apr 8, 2016
Persimmon の暫定的な assertSeqEquals を書いてみた
View assertSeqEquals.fs
(*
* The MIT License (MIT)
*
* Copyright (c) 2016 Kazuhiro Matsushima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the
* Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@Gab-km
Gab-km / factorialNumberSystem.fs
Created Mar 17, 2016
何をやりたいか分からなくなってきたので放流する
View factorialNumberSystem.fs
let rec factorial n =
match n with
| 0 | 1 -> 1
| _ -> n * (factorial (n - 1))
type FactorialNumber(num: int) =
let infactorials = Seq.initInfinite <| fun i -> factorial (i+1)
let range = Seq.takeWhile (fun fc -> fc <= num) infactorials |> Seq.toList
let rec factSystemize n fcs acc =
match fcs with
@Gab-km
Gab-km / ConsolePrinter.fs
Created Dec 15, 2015
何かのコード
View ConsolePrinter.fs
module ConsolePrinter =
open System.Text
open System.ComponentModel
[<EditorBrowsable(EditorBrowsableState.Never)>]
let private bit mask b =
b &&& mask = mask
[<EditorBrowsable(EditorBrowsableState.Never)>]
let private bit0 = bit 0b00000001uy
@Gab-km
Gab-km / gifts.fs
Created Dec 15, 2015
某所のアレをやってみた
View gifts.fs
type Family = Blair | Smith | Kelly | Tavares | Chen | Singh
type Person = { First: string; Last: Family }
let blair's first = { First = first; Last = Blair }
let smith's first = { First = first; Last = Smith }
let kelly's first = { First = first; Last = Kelly }
let tavares' first = { First = first; Last = Tavares }
let chen's first = { First = first; Last = Chen }
let singh's first = { First = first; Last = Singh }
@Gab-km
Gab-km / papylon_doc.ja.rst
Last active Dec 8, 2015
ぱぴろん非公式ドキュメント
View papylon_doc.ja.rst

ぱぴろん非公式ドキュメント

ぱぴろんとは?

ぱぴろん(Papylon)は、満たすべき性質(property)を記述することでテストケースを自動生成する Python 用テスティングツールです。いわゆる"QuickCheck"系の流れを汲み、 FsCheckScalaCheck の影響を強く受けています。テストしたい対象の振る舞うべき性質を記述して実行すると、テストケースをランダムに生成して実行し、性質が成り立つかどうかを確認します。

簡単な例

@Gab-km
Gab-km / hchobi_1.md
Last active Aug 29, 2015
この記事( http://d.hatena.ne.jp/kamekoopa/20141024/1414134734 )にインスピレーションされた。
View hchobi_1.md

List

  /\
a1 /\
  a2  /\
    a3   nil

foldr

@Gab-km
Gab-km / robustness_head.rst
Last active Aug 29, 2015
公式チュートリアルである "Getting Started with Erlang User's Guide" の翻訳 - Robustness (翻訳中)
View robustness_head.rst
@Gab-km
Gab-km / TestBuilder.fs
Last active Aug 29, 2015
テストをコンピュテーション式で書けないか、という思考実験
View TestBuilder.fs
// コンピュテーション式中で用いる型
type AssertionResult<'T> =
| NotAsserted of 'T
| Success
| Failure of string
// コンピュテーションビルダー
type TestBuilder() =
member self.Bind(x, f) =
match x with
You can’t perform that action at this time.