Skip to content

Instantly share code, notes, and snippets.

View kawakawa's full-sized avatar

Takuya Kawabe kawakawa

View GitHub Profile
@kawakawa
kawakawa / 増田 亨さんからのオブジェクト指向設計の問題の自分の回答
Last active August 29, 2015 14:01
ギルドワークス株式会社 増田 亨さんからのオブジェクト指向設計の問題
public abstract class 顧客区分{
private String 区分名;
private int デフォルト料金;
protected 料金 my料金object;
public 顧客区分(料金 料金object){
my料金object=料金object;
}
@kawakawa
kawakawa / FizzBuzz_part1.dart
Created July 12, 2014 05:35
DartでFizzBuzz
void fb(int n) {
if (n == 0) return;
fb(n - 1);
if(n%15==0){
print("FizzBuzz");
}else if(n%5==0){
print("Buzz");
}else if(n%3==0){
print("Fizz");
@kawakawa
kawakawa / C#サンプル
Created September 17, 2014 02:00
Selenium WebDriver でのtextarea要素のText部分を取得する際の改行コート有無について
//改行コード付きのテキストデータ
var textReturnCode = WebDriver.FindElement(By.TagName("textarea")).GetAttribute("value");
//改行コードなしのテキストデータ
var textNonReturnCode = WebDriver.FindElement(By.TagName("textarea")).Text;
var list=new List<string>
{
"リンゴ",
"オレンジ",
"パイナップル"
};
//toDictionary(int,string)に変換
var dic = list.Select((n, index) => new { index, n})
@kawakawa
kawakawa / gist:3698315
Created September 11, 2012 13:05
LINQ Sample1
int[] array = { 1, 10, 30, 40, 50, 70, 80, 90 };
//50以上の値の数(for)
int count = 0;
for (int i = 0; i < array.Length; i++)
{
if (array[i] >= 50)
{
count++;
}
Dim Array() As Integer = {1, 10, 30, 40, 50, 70, 80, 90}
'50以上の値の数(for)
Dim Count As Integer
Dim I As Long
For I = 0 To Array.Length - 1
If Array(I) >= 50 Then
Count = Count + 1
End If
Next
@kawakawa
kawakawa / charackterController
Created October 15, 2012 14:26
Unity character control
using UnityEngine;
using System.Collections;
public class MarioController: MonoBehaviour {
float WalkSpeed=3.0f; //歩く速度
float Gravity=20.0f; //重力係数
float JumpSpeed=8.0f; //ジャンプ加速度
private Vector3 velocity; //現在の速度
@kawakawa
kawakawa / gist:4199931
Created December 4, 2012 02:19
VbLiteUnit_Test_ForMat
Option Explicit
'VbLiteUnitを読み込みます
Implements ITestCase
Private Function ITestCase_TestCaseInstance() As ITestCase
Dim objResult As New ClassTest '自テストClass名を記載
Debug.Assert TypeName(objResult) = TypeName(Me)
Set ITestCase_TestCaseInstance = objResult
End Function
@kawakawa
kawakawa / gist:4663026
Last active December 11, 2015 21:29
euumに設定してあるDescription属性を取得する方法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;
namespace EnumDescriptionSample
{
class Program
@kawakawa
kawakawa / gist:4984461
Created February 19, 2013 09:44
SharePointで「値が有効な範囲にありません。」エラーが発生した時のソースサンプル
using (SPSite site = new SPSite(context.SiteUrl))
using (var web = site.OpenWeb(context.WebUrl))
{
var list = web.Lists[context.ListId];
var item = list.Items.GetItemById(itemId);
var value = item["フィールド名"]; //ここで例外が発生
}