このルールさえ押さえておけば、読んでいるコードが省略記法を使っていてもほぼ読めるようになります。
def concatAsString(a: Int, b: Int): String = {
val a_ = a.toString();
val b_ = b.toString();| function uuid() { | |
| var uuid = "", i, random; | |
| for (i = 0; i < 32; i++) { | |
| random = Math.random() * 16 | 0; | |
| if (i == 8 || i == 12 || i == 16 || i == 20) { | |
| uuid += "-" | |
| } | |
| uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16); | |
| } |
VagrantでAnsible管理サーバーを構築する。参考URLとほぼ一緒ですが、pipのインストール方法が変わっていたのと、公開鍵をコピーする方式の方が本番に向けやすいと思い修正しました。 参考: http://yteraoka.github.io/ansible-tutorial/#server-setup-using-vagrant
# boxのダウンロード
vagrant init centos6 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box
# [Vagrantfileが生成されるので、gistのVagrantfileと見比べて修正。]
vagrant up
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| # All Vagrant configuration is done here. The most common configuration | |
| # options are documented and commented below. For a complete reference, | |
| # please see the online documentation at vagrantup.com. |
| object Main extends App { | |
| def myif(p: => Boolean)(thenS: => Any)(elseS: => Any): Any = { | |
| var res: Any = null | |
| val result = p && { res = thenS; true} || { res = elseS; false} | |
| res | |
| } | |
| def myelse(elseS: => Any): Any = { | |
| elseS | |
| } |