Skip to content

Instantly share code, notes, and snippets.

View masaru-b-cl's full-sized avatar

TAKANO Sho / @masaru_b_cl masaru-b-cl

View GitHub Profile
@masaru-b-cl
masaru-b-cl / テストケース名.cs
Created December 6, 2013 16:00
TDD Advendt Calendar 2013 - リスト1
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TddAdventJp2013.Test
{
[TestClass]
public class テストケース名
{
[TestMethod]
public void Aがa1の場合・Bがb1ならばc1となる()
@masaru-b-cl
masaru-b-cl / MainWindow.xaml.cs
Created November 21, 2013 14:47
WeakEventパターンで実装
using System;
using System.Windows;
namespace WpfApplication1
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
@masaru-b-cl
masaru-b-cl / seqtomap.fs
Last active December 26, 2015 09:39
[1,2,3] から{0 => 1, 1 => 2, 3 => 2} を作りたい in F#
// 「F# Interactive」での実行結果
> [1; 2; 3]
- |> Seq.mapi (fun i x -> (i, x))
- |> Map.ofSeq
- ;;
val it : Map<int,int> = map [(0, 1); (1, 2); (2, 3)]
@masaru-b-cl
masaru-b-cl / UnitTest1.cs
Created October 24, 2013 03:49
[1,2,3] から{0 => 1, 1 => 2, 3 => 2} を作りたい in C#
using System;
using System.Linq;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
@masaru-b-cl
masaru-b-cl / UnitTest1.cs
Created October 22, 2013 03:58
文字列を指定した文字数で分割(C#版) ※非LINQ
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
public static class StringExtensions
{
public static string[] Nyan(this string value, int size)
@masaru-b-cl
masaru-b-cl / UnitTest1.cs
Created October 22, 2013 03:54
指定した文字数で文字列を分割(C#版)
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
public static class StringExtensions
{
public static string[] Nyan(this string value, int size)
@masaru-b-cl
masaru-b-cl / git-now
Last active January 24, 2024 02:22 — forked from mzp/git-now
#!/bin/sh
PREFIX="from now"
MESSAGE="[${PREFIX}] `date +\"%Y/%m/%d %T\"`"
MAIN_BRANCH=${1:-master} # デフォルトは 'master'、第1引数で上書き可能
shift # 引数リストからメインブランチ名を除外
get_amend() {
if [ -z `git log --pretty=oneline --no-color -1 | cut -d " " -f 2- | grep "^\[${PREFIX}]"` ]
* Class1
** summary
additional summary
** remarks
- list1
- list2
** example
var a = 1;
@masaru-b-cl
masaru-b-cl / grouping.csproj
Created May 23, 2013 15:01
ファイルのグループ化方法
<Compile Include="JdkVersionTest.cs" />
<Compile Include="JdkVersionTest.IsValid.cs">
<DependentUpon>JdkVersionTest.cs</DependentUpon>
</Compile>
@masaru-b-cl
masaru-b-cl / Program.cs
Created March 22, 2013 15:23
DynamicObjectのTry~でfalseを返すと・・・
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class MyDynamic : DynamicObject