Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View shrkw's full-sized avatar

Hiroyuki Shirakawa shrkw

  • Nagano, Japan
View GitHub Profile
@shrkw
shrkw / DDD-15.md
Created October 31, 2017 15:46
DDD

15章 蒸留

コアドメイン

汎用サブドメイン GENERIC SUB DOMAINS

  • 複数形であるところがポイント

汎用とは再利用可能という意味ではない

  • ここから。今日は15章を終えるつもり
  • 再利用ではなく汎用であるということ
  • コンポネント設計についてもこれが答えだと思う
@shrkw
shrkw / name_candidate.py
Last active November 6, 2016 14:02
字画の良い名前候補 http://enamae.net/
from bs4 import BeautifulSoup
import urllib2
import urllib
import codecs
def candidate(url):
req = urllib2.Request(url)
USERAGENT = 'Mozilla/5.0'
req.add_header("User-agent", USERAGENT)
@shrkw
shrkw / file0.rb
Last active February 2, 2020 16:34
RubyでScalaのケースクラスっぽいことがしたかったのでStructを使えばよかった ref: https://qiita.com/shrkw/items/79772b6691f1aee94570
class Food
attr_reader :price, :name
def initialize(price, name)
@price = price
@name = name
end
end
@shrkw
shrkw / playground.swift
Last active February 28, 2016 11:39
swift playground
//: Playground - noun: a place where people can play
import Cocoa
// string
var str = "Hello, playgroundaaa"
var ihoho = 34343
print(str)
str = "ニーハオ" + str
@shrkw
shrkw / niagara_rule.ja.md
Last active February 5, 2016 07:50
ナイアガラ ルール 日本語 意訳。ルールは20xx年発売 ドイツ版に基づく。
'##::: ##:'####::::'###:::::'######::::::'###::::'########:::::'###::::
 ###:: ##:. ##::::'## ##:::'##... ##::::'## ##::: ##.... ##:::'## ##:::
 ####: ##:: ##:::'##:. ##:: ##:::..::::'##:. ##:: ##:::: ##::'##:. ##::
 ## ## ##:: ##::'##:::. ##: ##::'####:'##:::. ##: ########::'##:::. ##:
 ##. ####:: ##:: #########: ##::: ##:: #########: ##.. ##::: #########:
 ##:. ###:: ##:: ##.... ##: ##::: ##:: ##.... ##: ##::. ##:: ##.... ##:
 ##::. ##:'####: ##:::: ##:. ######::: ##:::: ##: ##:::. ##: ##:::: ##:
..::::..::....::..:::::..:::......::::..:::::..::..:::::..::..:::::..::
@shrkw
shrkw / mvrck.scala
Last active January 30, 2016 14:05
scalamatsuri 2016
/*
* MAVE
* + RIcK
* -------
* Scala
*/
import scala.annotation.tailrec
@tailrec
@shrkw
shrkw / .zshenv.local
Created November 28, 2015 14:33
depends on aws, jq command, and an argument should be image id
function run-ec2 {
source ~/.virtualenv/CP-2710/bin/activate
aws ec2 run-instances --image-id $1 --instance-type t1.micro --key-name oregon > /tmp/run-i
aws_id=$(cat /tmp/run-i | jq -r '.Instances | .[] | .InstanceId')
echo "aws_id: $aws_id"
sleep 10
aws ec2 describe-instances --instance-ids $aws_id > /tmp/run-i
aws_ip=$(cat /tmp/run-i | jq -r '.Reservations | .[] | .Instances | .[] | .PublicDnsName')
echo "aws_ip: $aws_ip"
echo 'ssh -i ~/.ssh/id_rsa.aws.oregon -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ec2-user@$aws_ip'
class Animal
def initialize(species)
@species = species
end
def bark()
"bowbow"
end
def mew()
"mewwww"
end
class Animal
def initialize(species)
@species = species
end
def bark()
"bowbow"
end
def mew()
"mewwww"
end
@shrkw
shrkw / tor.py
Created August 5, 2015 08:29
tornado app on gunicorn
# https://github.com/benoitc/gunicorn/blob/master/examples/frameworks/tornadoapp.py
# gunicorn -k tornado tor:app
import tornado.ioloop
import tornado.web
import tornado.options
tornado.options.define('port', type=int, default='8080', help=u'port number')
class MainHandler(tornado.web.RequestHandler):
def get(self):