This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Watch a bashfile and run it if changed | |
function bash_monitor () { | |
if [[ -z "$1" ]]; then | |
echo "usage: bash_monitor <bashfilename>" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makePropertiable(obj) { | |
var getProps = function () { | |
this.__props = this.__props || {}; | |
return this.__props; | |
}, | |
emptyGet = function (currentValue) { | |
return currentValue; | |
}, | |
emptySet = function (newValue) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeEventable(obj) { | |
var getEventMap = function () { | |
this.__eventMap = this.__eventMap || {}; | |
return this.__eventMap; | |
}, | |
validateEventExistence = function (name) { | |
var eventMap = getEventMap.call(this); | |
if (typeof eventMap[name] === 'undefined') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
// 라이브리로드를 위한 코드 파일 | |
// https://github.com/gruntjs/grunt-contrib-livereload | |
var path = require('path'); | |
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
var folderMount = function folderMount(connect, point) { | |
return connect.static(path.resolve(point)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
concat: { | |
options: { | |
banner: '/*! <%= pkg.name %> - <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n\n', | |
separator: '\n' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
// Code snippets for livereload | |
// https://github.com/gruntjs/grunt-contrib-livereload | |
var path = require('path'); | |
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
var folderMount = function folderMount(connect, point) { | |
return connect.static(path.resolve(point)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = '0x48 0x65 0x6c 0x6c 0x6f'; // Hello | |
hexstr2binstr(str); //--> '0100 1000 0110 0101 0110 1100 0110 1100 0110 1111' | |
function hexstr2binstr(hexstr) { | |
return hexstr.split(' ').map(function (v) { | |
var bins = Number(v).toString(2).split(''); | |
while (bins.length < 8) { | |
bins.unshift('0'); // left padding with '0' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 데이터 타입을 미리 정의하고, 전달받은 데이터에서 타입에 맞는 값을 받아 설정한다. | |
* 타입 정의는 JSON 형태로 하며, 객체에 설정한 키값을 {{ }} 안에 dot으로 패스를 구분해 넣는다. | |
* { | |
* '전달받을 데이터의 키': '{{dot으로 구분한 키값}}', | |
* } | |
* | |
* @param {Object} context | |
* @param {Object} data | |
* @param {Object} typeDef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var p = function () { | |
var d = Q.defer(); | |
d.reject(); | |
return d.promise; | |
}; | |
# Case 1 | |
p() | |
.then(function () { | |
console.log('A'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
OlderNewer