Skip to content

Instantly share code, notes, and snippets.

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
}
@ababup1192
ababup1192 / Vagrantfile
Last active August 29, 2015 14:15
Play Docker をいい感じに変換。
# -*- 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.
@ababup1192
ababup1192 / README.md
Last active August 29, 2015 14:15
VagrantによるAnsible環境構築メモ。

Ansible Vagrant

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
@gakuzzzz
gakuzzzz / 1_.md
Last active August 2, 2023 01:59
Scala の省略ルール早覚え

Scala の省略ルール早覚え

このルールさえ押さえておけば、読んでいるコードが省略記法を使っていてもほぼ読めるようになります。

メソッド定義

def concatAsString(a: Int, b: Int): String = {
  val a_ = a.toString();
  val b_ = b.toString();
@jcxplorer
jcxplorer / uuid.js
Created February 12, 2011 16:58
UUID v4 generator in JavaScript (RFC4122 compliant)
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);
}