Skip to content

Instantly share code, notes, and snippets.

@azusa
azusa / gist:911283
Created April 9, 2011 09:51
ボーリングのスコア計算
#!/usr/bin/env ruby
#! coding: utf-8
class Bowling
def initialize()
@pins = []
end
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'open-uri'
require 'json'
uri="http://api.atnd.org/events/?format=json&event_id=" + ARGV[0]
json_string=""
open(uri){|f|
json_string=f.read
nmap ,l :call PHPLint()<CR>
function PHPLint()
let result = system(&ft . ' -l ' . bufname(""))
echo result
endfunction
@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
#!/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 / 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>
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);
# -*- 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";
#!/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/ "$@"
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));