Skip to content

Instantly share code, notes, and snippets.

View ibare's full-sized avatar
๐Ÿ˜ƒ
I'm happy!!

Kim Mintae ibare

๐Ÿ˜ƒ
I'm happy!!
  • Day1Company
  • Dubai, UAE
  • 11:00 (UTC +04:00)
View GitHub Profile
/* webpack raw-loader */
import template from './hello.html';
Vue.component('hello', {
template
});
@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'
}
};
// before
module.exports = {
api: {
development: {
apiUrl: ""
},
minor: {
apiUrl: ""
}
}
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) => {
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, {}),
const fooView = Woowahan.View.create('fooView', {
useStore: {
rules: 'orderRule, bannerRule',
addressInfo: {
props: 'si,gu,gun,detail',
listen: true
},
memberInfo: '*',
orderNo: 'orderInfo.orderNo'
@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);
@ibare
ibare / package.js
Created July 27, 2017 04:39
Business module package for woowahanjs
import * as actions from './actions';
import * as plugins from './plugins';
import myMiddleware from './middleware/mymiddleware';
import reducers from './reducers';
import views from './views';
export default {
view: views.shopFinder,
setup: function(app) {
@ibare
ibare / bind.js
Created August 2, 2017 05:01
bind function
const myview = Woowahan.View.create('bindExample', {
initialize() {
this.onDragend = this.onDragend.bind(this);
this.super();
},
viewDidMount() {
this.map.addListener(markerId, 'dragend', this.onDragend);
@ibare
ibare / pad.js
Created September 7, 2017 01:46
pad example
var pad = size => num => (Array(size-String(num).length+1)).join('0')+num;