This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'); | |
var exec = require('child_process').exec; | |
var zookeeper = require('node-zookeeper-client'); | |
var root_shard_path = '/shard1'; | |
var replSet = "arbiter"; | |
function exists(client){ | |
client.exists(root_shard_path, | |
function(event){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'); | |
var exec = require('child_process').exec; | |
var zookeeper = require('node-zookeeper-client'); | |
var root_shard_path = '/shard1'; | |
var replSet = "arbiter"; | |
function exists(client){ | |
client.exists(root_shard_path, | |
function(event){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mocha BDD Interface | |
// describe 함수는 given, when을 나타내는데 쓰이고 | |
// context 함수는 Scenario를 표현하는 데 쓰인다. | |
// it 함수는 then, User story의 결론을 보여준다. | |
var assert = require('assert'); | |
var totalDeposit = 0; | |
function Account(deposit){ | |
totalDeposit = deposit; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.abs = function(number){ | |
return number < 0 ? -number : number; | |
}; | |
exports.pow = function(x, y){ | |
var value = 1; | |
for( var i = 0; i < y; i++ ){ | |
value *= x; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var totalDeposit = 0; | |
var Account = function(deposit){ | |
totalDeposit = deposit; | |
}; | |
Account.prototype.getAccount= function(){ | |
return totalDeposit; | |
}; | |
Account.prototype.withDraw = function(money){ | |
this.money = money; | |
totalDeposit -= money; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('supertest'); | |
var express = require('express'); | |
var app = express(); | |
app.get('/users', function(req, res){ | |
res.send(200, { name : 'tobi'}); | |
}); | |
// get 함수를 통해 users에 request한 값이 잘 들어오는지 확인합니다. | |
// expect는 들어온 값들이 예상한(expect)한 값과 일치하는지 확인합니다. | |
request(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = 10 | |
var name: String? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const vendingMachine = Machine( | |
{ | |
id: "vendingMachine", | |
initial: "idle", | |
context: { | |
deposited: 0, | |
}, | |
states: { | |
idle: { | |
on: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const door = Machine({ | |
id: "door", | |
initial: "locked", | |
states: { | |
locked: { | |
id: "locked", | |
on: { UNLOCK: "unlocked" }, | |
}, | |
unlocked: { | |
initial: "closed", |