Skip to content

Instantly share code, notes, and snippets.

View posaunehm's full-sized avatar

Hiroshi Maekawa (a.k.a. Posaune) posaunehm

View GitHub Profile

きょんさんの資料, 自動テストの誤解とアンチパターン in 楽天 Tech Talkを読んでもやもやしたところをつらつらと。

疑問

  • 因子水準

    • ググると実験計画法が出てくる
    • 自由度的な意味で捉えればOK?
  • 「統合テスト実装者が得る幅広いプログラミングスキルとアーキテクチャ知識である」

    • 主客逆では?
@posaunehm
posaunehm / Sample.cs
Last active August 29, 2015 14:07
An sample method for Typetalk api with C# (https://developer.nulab-inc.com/docs/typetalk)
// Refer follwing modules:
// using System.Collections.Generic;
// using System.Net.Http;
// using System.Web.Script.Serialization;
private async void Application_Startup(object sender, StartupEventArgs e)
{
var clientId = "xxxxxxxxxxxx";
var clientSecret = "xxxxxxxxxxxxxxx";
var topicId = 0; //use your topic id
@posaunehm
posaunehm / NoSemicolonCsTest.cs
Created October 22, 2014 15:27
セミコロンレスC# ?
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
if (
System.Console.OpenStandardOutput()
.WriteAsync(System.Text.Encoding.Default.GetBytes("Hello Semicolonless World !!"), 0, System.Text.Encoding.Default.GetBytes("Hello Semicolonless World !!").Length) == null)
{ }
@posaunehm
posaunehm / ControlBindingHelper.cs
Created November 30, 2011 04:22
Extension method that helps updating binding target.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Controls;
using System.Windows;
namespace Infrastructure.Extensions
{
@posaunehm
posaunehm / AssemblyExtension
Created December 27, 2011 02:56
AssemblyExtension: A GetTypes method which have exception-ignoring option.
public static Type[] GetTypes(this Assembly assembly, bool ignoreReflectionTypeloadException)
{
if(ignoreReflectionTypeloadException)
{
Type[] types;
try
{
types = assembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
@posaunehm
posaunehm / gist:1660918
Created January 23, 2012 05:39
Vector Helper Extention Method
static readonly Vector ANGLE_BASE_VECTOR = new Vector(1, 0);
/// <summary>
/// ベクトルの角度をDegreeで返します
/// </summary>
/// <param name="vector">ベクトル</param>
/// <returns>角度(Degree値)</returns>
public static double GetAngle(this Vector vector)
{
return Vector.AngleBetween(ANGLE_BASE_VECTOR, vector);
@posaunehm
posaunehm / gist:1681072
Created January 26, 2012 04:52
BucketSort
public static IEnumerable<int> BucketSort(IEnumerable<int> input)
{
int[] bucket = new int[input.Max() + 1];
foreach(var ele in input)
{
bucket[ele]++;
}
return bucket.SelectMany((i, ele) => Enumerable.Range(0, i).Select(_ => ele));
}
@posaunehm
posaunehm / gist:2281427
Created April 2, 2012 07:36
A method enumurating all controls
static IEnumerable<Control> EnumurateAllControl(Control root)
{
yield return root;
foreach (var ctrl in root.Controls.Cast<Control>().SelectMany(c => EnumurateAllControl(c)))
{
yield return ctrl;
}
}
@posaunehm
posaunehm / gist:2282396
Created April 2, 2012 10:22
A method which returns all elements included in passed element
static IEnumerable<System.Windows.DependencyObject> EnumurateAllElement(System.Windows.DependencyObject root)
{
yield return root;
foreach (var element in GetChilren(root).SelectMany(ele => EnumurateAllElement(ele)))
{
yield return element;
}
}
static IEnumerable<System.Windows.DependencyObject> GetChilren(System.Windows.DependencyObject root)
@posaunehm
posaunehm / gist:2359381
Created April 11, 2012 13:45
Enumerate number without any local varuable
Console.Write(
string.Concat(
Enumerable.Range(1,100).SelectMany(ele => ele.ToString() + System.Environment.NewLine))
);