Skip to content

Instantly share code, notes, and snippets.

@azusa
azusa / gist:4632555
Last active December 11, 2015 17:08
Booleanのgetterはisかgetか
import static org.junit.Assert.assertEquals;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@azusa
azusa / AssertThatTest.java
Created October 17, 2012 07:46
JUnit3でassertThat。
package jp.fieldnotes.junit3;
import junit.framework.TestCase;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class AssertThatTest extends TestCase {
public void testAssertThatOnError(){
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import org.junit.Test;
public class CharacterTest {
@Test
public void test() {
assertThat(Character.isJavaIdentifierPart('文'), is(true));
#!/bin/bash
exec ruby -Ke -I ~/src/ruby/ruby-refm/bitclust/lib ~/src/ruby/ruby-refm/bitclust/bin/refe.rb -d ~/src/ruby/ruby-refm/db-1_9_2/ "$@"
# -*- coding: UTF-8 -*-
add_body_enter_proc{
<<EOS
<div class="social">
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/ja_JP/all.js#xfbml=1";
public static Class<?> getGenericClass(Class<?> clazz) throws IllegalArgumentException {
Type[] t = clazz.getGenericInterfaces();
if (t.length == 0) {
Class<?> parent = clazz.getSuperclass();
if (parent == null) {
throw new IllegalArgumentException(clazz.getName());
}
return getGenericClass(parent);
@azusa
azusa / private.xml
Created December 4, 2011 16:40
keyremap4macbookの設定
<?xml version="1.0"?>
<root>
<item>
<name>Terminal</name>
<identifier>private.swap_control_and_commnand</identifier>
<only>TERMINAL</only>
<autogen>--KeyToKey-- KeyCode::CONTROL_L, KeyCode::COMMAND_L</autogen>
<autogen>--KeyToKey-- KeyCode::COMMAND_L, KeyCode::CONTROL_L</autogen>
#!/bin/bash
ctags -f pear.tags --langmap=PHP:.php.inc --php-types=c+f `find /usr/local/lib/php/ -name '*.php' -or -name '*.inc'`
@azusa
azusa / lottery.rb
Created November 13, 2011 13:31
TDDBC抽選用プログラム
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require "CSV"
list=Array.new
rows = CSV.open(ARGV[0],"rb:windows-31j")
rows.shift
rows.each do |row|
list.push row
nmap ,l :call PHPLint()<CR>
function PHPLint()
let result = system(&ft . ' -l ' . bufname(""))
echo result
endfunction