Skip to content

Instantly share code, notes, and snippets.

@juzow13
juzow13 / phpunit.bootstrap.php
Created November 11, 2017 00:20
minimum phpunit.bootstrap.php
<?php
// For composer
require_once 'vendor/autoload.php';
@juzow13
juzow13 / phpunit.xml
Created November 11, 2017 00:19
minimum phpunit to start with
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="./tests/phpunit.bootstrap.php"
processIsolation="false"
verbose="true"
strict="false"
colors="true">
<testsuites>
<testsuite name="PHPUnit">
<directory>./tests</directory>
@juzow13
juzow13 / convert_isbn13_10.rb
Created October 13, 2017 12:27
convert isbn13 to isbn10
# isbn is isbn13
def to_isbn10(isbn)
digits = isbn.slice(3,9).split("")
sum = 0
(0..9).each do |i|
sum += digits[i].to_i * (10 - i)
end
chk_tmp = 11 - (sum % 11)
import mockit.Mock;
import mockit.MockUp;
import org.junit.Before;
import org.junit.Test;
private TestTarget target;
/*
複数のテストから呼び出せるようにメソッドとして書きました。
MyCollection = Backbone.Collection.extend({
model:MyModel,
url: "/mymodels",
fetchPerCategory: function (categoryId, options) {
options = options || {};
@juzow13
juzow13 / jruby_on_rails_install.sh
Created November 18, 2010 13:27
JRuby on rails install on Mac OS X using rvm
$ rvm install jruby
$ rvm default jruby
$ jruby -S gem install rails rspec rspec-rails
Successfully installed activesupport-3.0.3
Successfully installed builder-2.1.2
Successfully installed i18n-0.4.2
Successfully installed activemodel-3.0.3
...
$ jruby -S rails new jrubyapp