Skip to content

Instantly share code, notes, and snippets.

View ohneda's full-sized avatar

Yuichi Oneda ohneda

  • Fujisan Magazine Service USA
  • Berkeley CA, USA
View GitHub Profile
@ohneda
ohneda / chapter1.md
Last active August 29, 2015 14:06
サービスデザインパターン

第一章 オブジェクトからWebサービスへ

  1. Webサービスとはなにか
    • サービスをどのように使えば、論理的な機能を複数のアプリケーションで共有できるのか。構成の異なるコンピュータプラットフォームを強調して動くソフトウェアにできるのか
    • Web サービスは、異なるシステムを統合する方法を提供し、再利用可能なビジネス機能を、HTTP 経由で公開するもの
  2. ローカルオブジェクトから分散オブジェクトへ
    • オブジェクトとは、振る舞い(例:ビジネスロジック)とデータをカプセル化するために、現代の多くのプログラミング言語で使われているパラダイム
      • オブジェクトのホワイトボックス再利用
        • オブジェクトを使う開発者が、オブジェクトの実装に自由にアクセスできること
  • クライアントがオブジェクトを直接操作する
class GroovyBook {
String title
static main( args ){
Date now = new Date()
100000.times {
new GroovyBook( title: "title${it}")
}
println new Date().time - now.time
# users generic .zshrc file for zsh(1)
## Environment variable configuration
#
# LANG
#
export LANG=ja_JP.UTF-8
## Default shell configuration
#
@ohneda
ohneda / .vimrc
Created August 23, 2012 03:39
.vimrc
syntax on
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=0
set number
set smartindent
set incsearch
set hlsearch
@ohneda
ohneda / .tmux.conf
Created March 1, 2012 22:03
tmux configuration file
# $Id: screen-keys.conf,v 1.7 2010-07-31 11:39:13 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
@ohneda
ohneda / h2.sh
Created January 9, 2012 23:30
h2 database init script ( based on Jenkins init script )
# /etc/default/h2
# defaults for h2 database server
# pulled in from the init script; makes things easier.
NAME=h2
# location of java
JAVA=/usr/bin/java
# arguments to pass to java
@ohneda
ohneda / emacs.rb
Created December 28, 2011 04:06
patch for homebrew emacs-23.3b supporting emacs-inline.patch in non-japanese environments and ATOK24.
diff --git a/Library/Formula/emacs.rb b/Library/Formula/emacs.rb
index 856a34a..e46a312 100644
--- a/Library/Formula/emacs.rb
+++ b/Library/Formula/emacs.rb
@@ -28,7 +28,7 @@ class Emacs < Formula
def patches
p = []
-
+ p0 = []
@ohneda
ohneda / grails-version
Created December 21, 2011 22:40
Smart Bash/Zsh Aliases to Run Appropriate Grails Version
# via http://naleid.com/blog/2011/09/26/smart-bash-zsh-aliases-to-run-appropriate-grails-version/
GRAILS_CMD=$1
shift
if [ -f application.properties ]; then
export GRAILS_VERSION=`grep app.grails.version application.properties | sed -E 's/.*=(.*)/\1/'`
export GRAILS_HOME="/Users/ohneda/opt/grails-$GRAILS_VERSION"
echo "application.properties found, using \$GRAILS_HOME of $GRAILS_HOME"
else
echo "application.properties NOT found, leaving \$GRAILS_HOME as $GRAILS_HOME"
@ohneda
ohneda / gist:1453983
Created December 10, 2011 00:27
Print Error Log after running Tests/Specs on Grails
# Add the below into $YOUR_APP/scripts/_Events.groovy
# reference: http://d.hatena.ne.jp/masanobuimai/20090615
eventTestSuiteEnd = {type ->
new File(testReportsDir, "plain").eachFileMatch(~/.*[(Spec)|(Test)]\.txt/) { file ->
file.withReader("UTF-8") {reader ->
reader.readLine()
def line = reader.readLine()
(line =~ /.*, Failures: (\d), Errors: (\d), .*/).each {m0, m1, m2 ->
if (m1 == "0" && m2 == "0") return
println "== ${file.name} =============================================="
@ohneda
ohneda / StandardDeviationCategory.groovy
Created July 21, 2011 23:07
StandardDeviation Category for groovy, inspired by Advanced Rails
import static java.lang.Math.*
import static java.math.RoundingMode.CEILING
class StandardDeviationCategory {
static Double mean(Collection list) {
list.with{
scale(sum() / size())
}
}