Skip to content

Instantly share code, notes, and snippets.

View ibare's full-sized avatar
😃
I'm happy!!

Kim Mintae ibare

😃
I'm happy!!
  • WoowaBros
  • seoul, korea
View GitHub Profile
@ibare
ibare / js-exec-context.js
Last active July 11, 2017 05:34
javascript 실행 콘텍스트의 변화
function Foo() {
// this 는 new 연산자로 호출되었을 때를 전제한다
// this 는 인스턴스 객체
this.myname = 'Foo';
this.displayName = function() {
// this 는 인스턴스 객체를 전제한다.
// 따라서 반드시 [인스턴스].displayName() 으로 호출되어야한다
// 그렇게 하지 못할 경우 인스턴스 객체를 바인딩 시켜줘야야 this 가 인스턴스 객체를 가르킨다
// ㄴ displayName.bind([인스턴스])
console.log(this.myname);
const fooView = Woowahan.View.create('fooView', {
useStore: {
rules: 'orderRule, bannerRule',
addressInfo: {
props: 'si,gu,gun,detail',
listen: true
},
memberInfo: '*',
orderNo: 'orderInfo.orderNo'
Woowahan.View.create('myview', {
events: {
'@transaction fetch-order-info', 'doneAction'
},
doAction() {
this.createTransaction('fetch-order-info', [
Woowahan.Action.create(FETCH_ORDER_INFO, {}),
Woowahan.Action.create(FETCH_MEMBER_INFO, {}),
app.all('/v1/*', (req, res) => {
request[req.method.toLowerCase()]({
url: config.ApiServer+req.url,
headers: {
'Authorization': req.headers['authorization'],
'Content-Type': req.headers['content-type']
},
qs: req.query,
json: req.body
}, (err, response, body) => {
// before
module.exports = {
api: {
development: {
apiUrl: ""
},
minor: {
apiUrl: ""
}
}
@ibare
ibare / reducer-utils.js
Last active February 10, 2017 08:14
woowahanjs 리듀서 ajax 호출 전처리, 후처리 미들웨어 사용하기
export function beforeRequest(context, method, url, options = {}) {
method = method.toLowerCase();
let defaultOptions = {
timeout: 1000*10, // 10sec
headers: {
'Authorization': 'Bearer xxx-token-xxx',
'Content-Type':'application/json'
}
};
/* webpack raw-loader */
import template from './hello.html';
Vue.component('hello', {
template
});
function WoowaView(options) {
return function() {
this.template = options.template;
this.render = function(list) {
var item = [];
for(var i=0; i<list.length; i++) {
item.push('<li>'+list[i]+'</li>')
@ibare
ibare / foo-box-step1.js
Last active August 16, 2016 00:08
혼자 바보같이 움직이는 박스 예제
// https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js
var adjust = 1;
var ui = $('#box');
var direction = ['up','right','down','left'];
function box() {
var min = 0, max = direction.length;
var selectDirection = Math.floor(Math.random()*(max-min+1)+min);
@ibare
ibare / Step1.js
Last active August 9, 2016 00:01
Move Box Tutorial
var box = $('#box');
function forwardPos(p) {
return (p+1)+'px';
}
function backwardPos(p) {
return (p-1)+'px';
}