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 org.junit.After; | |
import org.junit.Before; | |
public abstract class BaseTest { | |
@Before | |
public void setUp() throws Exception { | |
// setup | |
} |
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
@Model(schemaVersion = 1) | |
public class SampleModel implements Serializable { | |
private String oldText; | |
@Attribute(lob = true) | |
private String newText; | |
public String getText(){ | |
if(newText == null){ | |
return oldText; |
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
require 'rubygems' | |
require 'android_market_api' | |
p "app detail" | |
p AndroidMarketApplication.new('jp.drecom.sg.nprwidget') | |
# Not Found | |
#p "get_overall_top_selling_free_app" | |
#p AndroidMarket.get_overall_top_selling_free_app(15) |
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
# -*- coding: utf-8 -*- | |
require "rspec" | |
=begin | |
example) | |
[1, 2, 3].should array_instance_of Fixnum | |
=end | |
RSpec::Matchers.define :array_instance_of do |element_class| | |
match do |array| |
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
# -*- coding: utf-8 -*- | |
require 'spec_helper' | |
describe String do | |
it "match with be_include" do | |
"cure peace".should be_include "azatoi" | |
=begin | |
error message | |
1) String match with be_include |
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
# extract example seconds from rspec profile log | |
# | |
# required: | |
# rspec >= 2.10.0 | |
# Jenkins Plot Plugin | |
# | |
# usage: | |
# rspec --profile 5 > rspec-console.log # rspec >= 2.13.0 | |
# rspec --profile > rspec-console.log # 2.10.0 <= rspec < 2.13.0 | |
# ruby plot-rspec-slowest-examples.rb rspec-console.log > plot.csv |
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
# https://gist.github.com/sue445/5261654 | |
ja: | |
helpers: | |
actions: "Actions" | |
links: | |
back: "戻る" | |
cancel: "キャンセル" | |
confirm: "本当にいいですか?" | |
destroy: "削除" |
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
$ rspec --version | |
2.13.1 | |
$ rspec -- sample1_spec.rb | |
before(:all) | |
subject! | |
let! | |
before(:each) | |
it | |
after(:each) |
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 org.slim3.memcache.Memcache | |
def stats = Memcache.statistics() | |
def totalCount = stats.getHitCount() + stats.getMissCount() | |
def hitRatio = stats.getHitCount() / totalCount | |
println hitRatio |
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 org.slim3.util.ServletContextLocator | |
def servletContext = ServletContextLocator.get() | |
def serverInfo = servletContext.serverInfo | |
println serverInfo // => Google App Engine/Google App Engine/1.8.0 |