Skip to content

Instantly share code, notes, and snippets.

View miconblog's full-sized avatar
🏠
Working at home

Sohn, ByoungDae miconblog

🏠
Working at home
View GitHub Profile
@miconblog
miconblog / protips.js
Created July 10, 2018 13:05 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@miconblog
miconblog / README.md
Last active July 2, 2017 16:41
deploy node app when git pushed.

Git 레파지토리 커밋하면 자동으로 배포하기

사전에 필요한 것들 (requirement..)

  1. git 프로토콜 사용을 위해 SSH 설정을 미리 해두세요! ( need SSH key )
  2. 배포 스크립트를 미리 만들어 두세요! ( need a script for dist )

데몬을 실행하는 방법 (How to start demon..)

$> node git2distd.js & 
# AWS의 S3 버킷 정책을 미리 풀어둡니다.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::rlibro/UPLOAD_PATH/*"
(function() {
var setUpIndicator = function(){
console.log("새로운 DB를 다운로드합니다.");
};
var setDownIndicator = function(){
console.log("데이터베이스를 완료!!");
};
@miconblog
miconblog / autologin.js
Last active August 29, 2015 14:10
Login & Register Event with phantomjs
var page = new WebPage();
var config = require('./config');
var loginsuccess = false;
var imageFormat = {format: 'png', quality: '10'};
var USER = {};
var USER_INDEX = 0;
page.onUrlChanged = function(targetUrl){
if( targetUrl === config.mainUrl ){
console.log("로그인 성공!");
@miconblog
miconblog / pipeline
Created November 7, 2014 08:59
execute promise collections
/**
* Promises 객체를 순차적으로 실행시켜주는 파이프 라인 클래스
* .loop() - 무한 루프로 돌려준다. (default:0)
* .loop(1) - 루프를 한번만 돈다.
*/
function noop (){}
module.exports = function Pipeline (promiseArray, params) {
var promises = promiseArray;