Skip to content

Instantly share code, notes, and snippets.

@haiiro-shimeji
haiiro-shimeji / event-driven-arch.ts
Last active December 31, 2019 08:19
実践DDD ch.4.7の イベント駆動アーキテクチャをRxJSで実装してみたやつ
/**
* 実践DDD cp.4.7 のイベント駆動アーキテクチャの実装を、RxJSをつかってやってみたやつ.
*/
import { Subject, Observable, Observer } from 'rxjs';
import { count, filter } from 'rxjs/operators';
/**
* ダミーデータストリームの作成.
*/
@haiiro-shimeji
haiiro-shimeji / handle_error.py
Created October 6, 2019 06:48
Error handling and logging guidelines
""" logging sample
"""
import json
import os
import logging
import traceback
def lambda_handler(_event, _context):
"""Sample pure Lambda function
""" abc055_b """
import sys
from functools import reduce
H = pow(10, 9) + 7
def _main():
_n = int(sys.stdin.readline())
#The following lines were added by compinstall
zstyle :compinstall filename $HOME/.zshrc
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
[user]
name = Shoichi Ikeda
email = ikeda@localhost.localdomain
[color]
# colorの設定(以下のコマンドは自動で色つける)
status = auto
diff = auto
branch = auto
interactive = auto
grep = auto
set nocompatible
filetype off
set runtimepath+=~/.vim/bundle/neobundle.vim/
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/neocomplcache'
@haiiro-shimeji
haiiro-shimeji / Vagrantfile
Created June 24, 2017 05:58
Vagrantfile for docker
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list
sudo apt-get update
@haiiro-shimeji
haiiro-shimeji / 00. Resource.js
Last active April 22, 2017 12:23
GeneratorとPromiseの勉強ということでオレオレなco moduleを実装
//Dummy resource
module.exports = {
open: function() {
var res = {
read: function() {
return new Promise(function(_resolve, _reject) {
setTimeout(function() {
_resolve('hogeeee');
//_reject('read error!');
@haiiro-shimeji
haiiro-shimeji / 00. Resource.js
Last active April 22, 2017 07:59
Javascript asynchronous sample
//Dummy resource
module.exports = {
open: function() {
var res = {
read: function() {
return new Promise(function(_resolve, _reject) {
setTimeout(function() {
_resolve('hogeeee');
//return _reject('read error!');
console.log('hoge');
Promise.resolve()
.then(function() {
return new Promise(function(resolve) {
setTimeout(function() {
resolve('fuga');
}, 1000);
});
})