This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
() | |
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package matchers; | |
import java.util.regex.Pattern; | |
import org.hamcrest.Description; | |
import org.junit.internal.matchers.TypeSafeMatcher; | |
public class RegexMatcher extends TypeSafeMatcher<String> { | |
private final String criteria; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils; | |
import junit.framework.TestCase; | |
import org.junit.Test; | |
public class StringJUtilsTest extends TestCase { | |
@Test | |
public void test_fullHiraganaToFullKatakana() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils; | |
public class StringJUtils { | |
private static final char[] HALF_KATAKANA = { '。', '「', '」', '、', '・', | |
'ヲ', 'ァ', 'ィ', 'ゥ', 'ェ', 'ォ', 'ャ', 'ュ', 'ョ', 'ッ', 'ー', 'ア', 'イ', | |
'ウ', 'エ', 'オ', 'カ', 'キ', 'ク', 'ケ', 'コ', 'サ', 'シ', 'ス', 'セ', 'ソ', | |
'タ', 'チ', 'ツ', 'テ', 'ト', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'ヒ', 'フ', | |
'ヘ', 'ホ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ヤ', 'ユ', 'ヨ', 'ラ', 'リ', 'ル', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.res.Resources; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.graphics.Canvas; | |
import android.graphics.Point; | |
import android.view.GestureDetector; | |
import android.view.GestureDetector.SimpleOnGestureListener; | |
import android.view.MotionEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PHP5.3以降 | |
function bentch($count, $func) { | |
$start_m = microtime(); | |
$start = time(); | |
for ($i = 0; $i < $count; $i++) { | |
$func(); | |
} | |
$end_m = microtime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
print_r( | |
array_filter( | |
range(2, 100), function ($num) { | |
return !in_array(0, array_map(function ($n) use ($num) { | |
return $num % $n; | |
}, range(2, $num - 1))); | |
} | |
) |