Skip to content

Instantly share code, notes, and snippets.

View echo304's full-sized avatar

Sangboak Lee echo304

  • Coquitlam, Canada
  • 23:48 (UTC -07:00)
  • LinkedIn in/echo304
View GitHub Profile
@echo304
echo304 / gulpfile.js
Created June 9, 2016 22:24
Gulp : BrowserSync + Nodemon(ExpressJS)
var gulp = require('gulp');
var bs = require('browser-sync').create();
var nodemon = require('gulp-nodemon');
gulp.task('browser-sync', ['nodemon'], function() {
bs.init(null, {
// server side port
proxy: "http://localhost:3000",
@echo304
echo304 / gulpfile.js
Created June 20, 2016 02:58
Gulp: Nodemon + Mocha + Istanbul
var gulp = require('gulp');
var nodemon = require('gulp-nodemon');
var mocha = require('gulp-mocha');
var wait = require('gulp-wait');
var istanbul = require('gulp-istanbul');
var plumber = require('gulp-plumber');
gulp.task('pre-test', function () {
gulp.src(['server/**/*.js']) // Covering files
// with includeUntested option, Istanbul will check test coverage upon
@echo304
echo304 / .bash_profile
Last active November 17, 2016 02:00
Git setting
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias gco='git checkout '
alias gk='gitk --all&'
alias gx='gitx --all'
alias g='git '
var obj = {};
obj.toString;
// function toString() { [native code] }
var emptyObj = Object.create(null);
emptyObj.toString;
// undefined
var map = new Map();
map.get('toString');
/* 빈 Map 만들기 */
var map = new Map();
// Map(0) {}
/* Key/value 저장하기 */
map.set('first', 1);
map.set('second', 2);
/* Key/value 불러오기 */
map.get('first');
var keyFn = () => {};
var keyObj = {};
var keyArray = [];
map.set(1, 1);
map.set('two', 'two');
map.set(keyFn, keyfn);
map.set(keyObj, keyObj);
map.set(keyArray, keyArray);
var obj = { a: 1, b: 2 };
var count = 0;
for (var key in obj) { count++; }
console.log(count);
// 2
var map = new Map([['a', 1], ['b', 2]]);
map.size
// 2
import React, { PropTypes } from 'react';
export default class AsyncComponent extends React.Component {
static propTypes = {
loader: PropTypes.func.isRequired,
}
state = {
Component: null,
}
import React, { PropTypes } from 'react';
import AsyncComponent from './AsyncComponent';
export const App = () => (
<AsyncComponent loader={() => import('components/SomeComponent')} />
)
import SyncComponent from './SyncComponent';
// Dynamic import
const dynamicImportPromise = import('./AsyncComponent');
dynamicImportPromise.then((module) => {
/* DO SOMETHING */
}