oinume journal

Scratchpad of what I learned

First loaded configuration becomes default_server in nginx

How nginx processes a request

server {
    listen      80;
    server_name example.org www.example.org;
    ...
}

server {
    listen      80;
    server_name example.net www.example.net;
    ...
}

server {
    listen      80;
    server_name example.com www.example.com;
    ...
}
In this configuration nginx tests only the request’s header field “Host” to determine which server the request should be routed to. If its value does not match any server name, or the request does not contain this header field at all, then nginx will route the request to the default server for this port. In the configuration above, the default server is the first one — which is nginx’s standard default behaviour.

I didn't know this behaviour and I should always add default_server to prevent someone from misunderstanding like this.

server {
    listen      80 default_server;
    server_name _;
}

Making an enviroment to learn ES6 with babel

This is a just memo for me who is a beginner of front-end development.

First of all, install nodejs v4.4.0.

$ brew install homebrew/versions/node4-lts
$ node -v
v4.4.0

Put package.json into a current directory. DO NOT forget to add babel-preset-es2015.

{
  "name": "hello",
  "version": "1.0.0",
  "engines": {
    "node": "4.4.0",
    "npm": "3.8.2"
  },
  "devDependencies": {
    "babel-cli": "^6.0.0",
    "babel-preset-es2015": "^6.6.0"
  }
}

Run npm install

$ npm install 

Put .babelrc to tell babel using es2015 preset.

echo '{ "presets": ["es2015"] }' > .babelrc

Put hello.js.

"use strict";

class Hello {
    say(message) {
        console.log(message);
    }
}

new Hello().say("hello");

Transpile hello.js and run it.

$ node_modules/.bin/babel hello.js | node
hello

Tokyo Developers Meetup 17に行ってきた

www.meetup.com

こんなイベントがあることを知って行ってきました。最初はボッチで同じテーブルの人も話しかけてくれないし、開始10分ぐらいでもう帰ろうかと思ったけど、自分から "This is the first time to come here. May I introduce myself?" と言って同じテーブルの人に話しかけたらそこから話がなんとかつながって、他の人ともしゃべるようになりました。

  • 目の前に座っていた人は日本にもう10年ぐらい住んでいて、自分の会社を持っているんだとか。そして、Haskel/Rust使いでDevOps系を仕事にしているらしい。「今どんなことやっているの?」って聞いたら「NixOSのパッケージ作ってた」って言ってて、NixOSなんてものを初めて知りました。
  • 隣の人はサンフランシスコから来ていて、Scala使いだそうで、「今日東京でScala Matsuriっていう大きいイベントやってるよ」って言ったらすごく悔しそうにしてた
  • pyconjpの理事をやりつつ日本でスタートアップをやっている人もいて、その人の会社について色々教えてもらった
  • 途中で挙手制の自己紹介タイムがあって、「会社をやってて絶賛エンジニア募集中〜(意訳)」ということを言っている人が4,5人いたので、仕事を探してる人にもいいのかも
    • disrupting JAPAN というPodcastをやっているよ、なんていう人もいた。面白そうなので聞いてみようと思う
  • 全体としては、PCに向かって作業している人もいたり、ずっと喋っている人もいたりでかなりフリーダムな感じ。たまたまフォトグラファーの人もいたので全員で集合写真撮ったり。

インド人やフランス人やアメリカ人など色んな国の人が参加していて色んなナマの英語が聞けたのと、NixOSなんていうすごいものをしれたので自分としては参加してすごく良かったです。月一ぐらいでやっているのでまた来月も参加したい。

MySQL Casual Talks vol.9でしゃべってきた

表題の通りでMySQL Casualで「カジュアルに本番データを開発環境に入れる」というタイトルで発表してきました。

当日はカジュアルウォーターを飲んでしまい発表時に顔が真っ赤になっていましたが、おかげで全く緊張しませんでしたw

自分の発表があったのであまり他の人の話を聞く余裕がなかったのですが、いい感じにまとめられていたのでこれからじっくり読もうと思います。

togetter.com

会場を提供してくれたYahoo!さんありがとうございました!