Skip to content

Instantly share code, notes, and snippets.

View Hochul822's full-sized avatar

Roark(Hochul) Hochul822

View GitHub Profile
@Hochul822
Hochul822 / machine.js
Created June 30, 2023 17:12
Generated by XState Viz: https://xstate.js.org/viz
const door = Machine({
id: "door",
initial: "locked",
states: {
locked: {
id: "locked",
on: { UNLOCK: "unlocked" },
},
unlocked: {
initial: "closed",
@Hochul822
Hochul822 / machine.js
Last active June 30, 2023 17:02
Generated by XState Viz: https://xstate.js.org/viz
const vendingMachine = Machine(
{
id: "vendingMachine",
initial: "idle",
context: {
deposited: 0,
},
states: {
idle: {
on: {
var a = 10
var name: String? = null
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)
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;
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;
}
// Mocha BDD Interface
// describe 함수는 given, when을 나타내는데 쓰이고
// context 함수는 Scenario를 표현하는 데 쓰인다.
// it 함수는 then, User story의 결론을 보여준다.
var assert = require('assert');
var totalDeposit = 0;
function Account(deposit){
totalDeposit = deposit;
};
@Hochul822
Hochul822 / test.js
Created August 6, 2015 04:52
Hello Gist
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){
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){