This file contains hidden or 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
// java.util.List の初期化を一行で書く | |
List<String> list = new ArrayList<String>() {{add("a"); add("b"); add("c");}}; | |
// 変更不可能な List で良い場合は | |
List list = Arrays.asList("a", "b", "c"); | |
// Arrays.asList をジェネリックスを使って書くと | |
List<Integer> list = Arrays.<Integer>asList(1, 2, 3); | |
// asList を使いつつ、追加可能な List を作るには、冗長だが以下のようにする | |
List<Integer> list = new ArrayList<Integer>(Arrays.<Integer>asList(1, 2, 3)); |
This file contains hidden or 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
require 'rubygems' | |
require 'cassandra' | |
include Cassandra::Constants | |
client = Cassandra.new('Keyspace1', '127.0.0.1:9160') | |
client.insert(:Standard1, 'bar', { 'name' => 'bar' } ) | |
client.insert(:Standard1, 'bar', { 'age' => '99' } ) | |
p client.get(:Standard1, 'bar') |
This file contains hidden or 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
require 'rubygems' | |
require 'cassandra' | |
include Cassandra::Constants | |
client = Cassandra.new('Keyspace1', '127.0.0.1:9160') | |
client.batch do | |
client.insert(:Standard1, '001', { 'first' => 'shin', 'last' => 'akiyama', 'age' => '31' }) | |
client.insert(:Standard1, '002', { 'first' => 'foo', 'last' => 'bar', 'age' => '20' }) | |
client.insert(:Standard1, '003', { 'first' => 'hoge', 'last' => 'fuga', 'age' => '15' }) |
This file contains hidden or 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
require 'rubygems' | |
require 'cassandra' | |
include Cassandra::Constants | |
client = Cassandra.new('Keyspace1', '127.0.0.1:9160') | |
# SuperColumn として name を指定 | |
client.insert(:Super1, 'foo', { 'name' => {'first' => 'bar', 'last' => 'baz'} } ) | |
# SuperColumn はあってもなくても可 | |
client.insert(:Super1, 'foo', { 'age' => '99' } ) |
This file contains hidden or 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
#!/usr/local/bin/ruby | |
# | |
# WWW SQL Designer を他の ER 図作成ツールと併用している場合に、 | |
# 変更された DB から再インポートする度にテーブルの座標を直すのが面倒で作成したスクリプト。 | |
# インポート後に実行すれば以前のバージョンで調整済みのダイアグラムの位置については同じになるので、 | |
# 後は追加で変更した部分の座標のみ手で調整してやれば OK。 | |
# | |
require 'rubygems' |
This file contains hidden or 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
require 'rubygems' rescue nil | |
require 'win32console' | |
require 'wirble' | |
require 'hirb' | |
# require 'hirb-unicode' | |
require 'pp' | |
require 'awesome_print' | |
# irb の設定 | |
IRB.conf[:SAVE_HISTORY] = 100000 |
This file contains hidden or 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
#!/bin/sh | |
# backup file directory | |
if [ ! -d $HOME/tmp ] | |
then | |
echo "create directory $HOME/tmp" | |
mkdir $HOME/tmp | |
fi | |
# plugin directory |
This file contains hidden or 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
" for vundle | |
if filereadable(expand("~/.vimrc.vundle")) | |
source ~/.vimrc.vundle | |
endif | |
" for neobundle | |
if filereadable(expand("~/.vimrc.neobundle")) | |
source ~/.vimrc.neobundle | |
endif |
This file contains hidden or 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
# encoding: utf-8 | |
# Ruby 1.9 + tmail-1.2.7 環境での | |
#「Encoding::CompatibilityError (incompatible encoding regexp match (ASCII-8BIT regexp with ISO-2022-JP string))」 | |
# エラー対策。 | |
# Rails の場合 config/initializers 以下に配置する。 | |
# | |
module TMail | |
class Encoder | |
def phrase( str ) | |
str = normalize_encoding(str) |
This file contains hidden or 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
" 縦幅 | |
set lines=60 | |
" 横幅 | |
set columns=160 | |
" クリップボード共有 | |
set clipboard=unnamed | |
" ツールバーを削除 |
OlderNewer