Skip to content

Instantly share code, notes, and snippets.

@yattom
yattom / gist:6ffc5cee8a6cddb9134bae6f3561901b
Last active October 28, 2019 00:25
small greasemonkey script to make facebook more productive (i.e. less counterproductive)
// ==UserScript==
// @name Facebook cleaner
// @namespace http://yattom.jp
// @include https://www.facebook.com/
// @version 2
// @grant GM_addStyle
// ==/UserScript==
// 右側の、上から3番目のエリアに、People You May Knowや、広告が表示される。それを非表示にする。
var ego_section = document.getElementsByClassName("ego_section");
@yattom
yattom / __main__.py
Created December 28, 2017 07:01
du.py
import sys
from du import main
if __name__=='__main__':
if len(sys.argv) > 1:
main.main(sys.argv[1])
else:
main.main()

スーパーの支払金額計算

スーパーで買い物したときの支払金額を計算する

以下の商品リストがあるとする。先頭の数字は商品番号。

  1. りんご 100円
  2. みかん 40円
  3. ぶどう 150円
  4. のり弁 350円
@yattom
yattom / fraction.md
Last active July 25, 2017 22:54
TDDのお題 計算機

いろいろな計算ができる計算機を作ってください。以下のインターフェースはあくまで一例(イメージ)です。

  1. 整数の足し算ができるようにしてください

calc("+", 3, 4) => 7

  1. 整数の引き算ができるようにしてください

calc("-", 10, 4) => 6

PLoP(Pattern Language of Programming)のイベントで知ったアイスブレークがあります。

  1. 全員が輪になる
  2. 最初の1人(司会など)がスタートとして、右の人に"tic"、左の人に"toc"という
  3. あとは、以下のルールで伝えていく
    • なにか(ticかtoc)言われたら、"What?"と聞き返す
    • "What?"と右から言われたら、そのまま左に"What?"と流す。左から言われたら右に
    • 2回目になにか(ticかtoc)言われたら、その言葉を次の人に伝える(右から来たら左へ、左から来たら右へ)
  4. ぐるっと回って最初の人までticとtocが伝わったら、おわり
在庫管理システムをモデリングしてください。
以下の機能が必要です。
* 商品ごとに在庫がいくつあるか管理できる
* 出荷時に、倉庫に対して何をいくつ出荷するかピッキングリストを表示する
* 商品の変化(入荷、出荷、移動、など)をすべて記録し、履歴が残る
## ユースケース001
前提: 商品Aが50個在庫している
@yattom
yattom / vending_machine.rb
Last active September 17, 2018 11:52
自動販売機のRubyコードとspecファイル。モブプログラミングでTDDで書いたもの。アジャイルジャパン2017にて / VendingMachine ruby code and spec written in a mob programming session in TDD way at Ajile Japan 2017
# cola/lib/vending_machine.rb
class VendingMachine
attr_reader :dispense_box
attr_reader :refund_box
attr_accessor :zaiko_count
def initialize
@zaiko_count = 1
end
function prompt() {
Write-Host "[" -nonewline
Write-Host "$(Get-Location)" -foregroundcolor Cyan -nonewline
Write-Host "]" -nonewline
Write-Host " ${env:USERNAME}@${env:COMPUTERNAME}" -foregroundcolor Magenta
"> "
}
function Add-Path($path) {
if("" -eq $path) {
研修、トレーニング、ワークショップ 1回(1日) 15万円

First you want some software. You know what you want, so it makes sense that it’s most convenient if the the software is built by yourself.

Unfortunately (or luckily) you’re too busy doing your own stuff to write a software. You call up someone and ask him to write the software for you. You save time and he got a job. Win-Win!

But wait. He needs to understand what you want. You need to tell the developer what you want. You need communication. One of the problems of communication is you cannot tell if you successfully communicated. You ask something. The only way to see if your request is communicated right is to see the resulting product. The developer show the product as a proof of the communication.

Time is money. If it proves wrong after several months, ah-oh. It’s wasted time. You don’t want to waste time or money. You want to see the proof early, as early as possible. So the developer wants to, for the sake of a satisfied customer, create only a small chunk of software and show it to yo