$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
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 scala.util.Random | |
object Main { | |
def main(args: Array[String]): Unit = { | |
val a = new KlassA(new Random) | |
println(a.nextInt) | |
println(a.nextInt) | |
val b = new KlassB(3) | |
b.put |
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
// 前提として: | |
// FizzBuzzをレイヤードアーキテクチャにする必要はあまり感じないが、 | |
// それでも | |
// 「3の倍数のときは fizz が返る」 | |
// 「5の倍数のときは buzz が返る」 | |
// 「3の倍数かつ5の倍数のときは fizzbuzz が返る」 | |
// 「3の倍数でも5の倍数でもないときはそのままの数字が返る」 | |
// というロジックがdomain layerなのか | |
// usecase layerなのかを無理やり当てはめるのであれば…… |
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
s///; | |
my @bap = ('$_[++$_]->%* is a', +{ "hard" => "bap" }, "code"); | |
sub hard { print | |
$_[++$_]->%* | |
} | |
hard @bap; |
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
// JS側はこういうインターフェースになってるとする | |
exports.nyan = function({a, b}){ | |
console.log(a); | |
console.log(b); | |
} |
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
class ComponentBuilder[X](a: X, b:X) { | |
class ClassA[X](val v: X) | |
class ClassB[X](val v: X) | |
def buildA = new ClassA(a) | |
def buildB = new ClassB(b) | |
} | |
val b = new ComponentBuilder[Int](1, 2) | |
println(b.buildA.v) // 1 |
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
class ComponentBuilder[X](a: X, b:X) { | |
class ClassA[X](val v: X) | |
class ClassB[X](val v: X) | |
def buildA = new ClassA(x) | |
def buildB = new ClassB(y) | |
} | |
val b = new ComponentBuilder[Int](1, 2) | |
println(b.buildA.x) |
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 "active_record" | |
# DB接続設定 | |
ActiveRecord::Base.establish_connection( | |
adapter: "sqlite3", | |
database: ':memory:' | |
) | |
# スキーマの設定 | |
class InitialSchema < ActiveRecord::Migration |
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
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' formats '[%r - %b](%s)' | |
zstyle ':vcs_info:*' actionformats '(%s)-[%r - %b|%a]' | |
precmd () { | |
psvar=() | |
LANG=en_US.UTF-8 vcs_info | |
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_ " | |
psvar[2]=$(date +'%m/%d %H:%M:%S'); | |
} |
NewerOlder