Skip to content

Instantly share code, notes, and snippets.

Avatar

Constantine Kim 김현진 elegantcoder

View GitHub Profile
View hashids.extension.coffee
# hashids (https://www.npmjs.org/package/hashids) make to support encrypt/decrypt string, json.
hashIds = new Hashids(secret);
hashIds.encryptString = (str) ->
hashIds.encrypt([].slice.call(new Buffer(str)));
hashIds.decryptString = (encrypted) ->
new Buffer(hashIds.decrypt(encrypted)).toString()
hashIds.encryptJSON = (obj) ->
hashIds.encrypt([].slice.call(new Buffer(JSON.stringify(obj))));
View sidebar-isActive.js
angular.module('sidebar', [])
.controller('SidebarCtrl', function ($scope, $route) {
$scope.isActive = function (url) {
return $route.current.$$route.controller === $route.routes[url].controller;
}
});
View iso_639-2.json
{
"aar":
{
"int":["Afar"],
"native":["Afaraf"]
},
"aa":
{
"int":["Afar"],
"native":["Afaraf"]
View gist:4d1aee23511803202e90
# case 1
module.exports = function (options) {
options.blah;
}
# case2
module.exports = function () {
var options = require('../config.js');
options.blah
}
View angular-watch-translate.js
// watch - translate - assign other member of scope
// check out how it works at http://jsfiddle.net/SWe4r/1/
var app = angular.module('watcherApp', []);
app.controller('watcherController', function ($scope) {
$scope.source = 'aaaaaa';
$scope.foo = {
bar: 'aaa'
};
$scope.bar = {
View gist:7095440
log = (input) ->
Math.log(input) / Math.log(26)
getColName = (input) ->
temp = input
char = ''
result = ''
# temp -= temp / temp^power
# console.log power
@elegantcoder
elegantcoder / iso-639-1.js
Last active Dec 25, 2015
ISO639; 2 Letter codes
View iso-639-1.js
module.exports = [
"ab",
"aa",
"af",
"ak",
"sq",
"am",
"ar",
"an",
"hy",
View install_chef.sh
echo "deb http://apt.opscode.com/ precise-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
sudo mkdir -p /etc/apt/trusted.gpg.d
gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
sudo apt-get -y update
sudo apt-get -y install opscode-keyring
sudo apt-get -y upgrade
sudo apt-get -y install chef
View backbone-event-logger.coffee
_.each(_.functions(Backbone.Events), (functionName) ->
Backbone.Events[functionName] = _.wrap(Backbone.Events[functionName], (fun) ->
args = _.toArray(arguments).slice(1)
console.log.call console, _.flatten([functionName, args])
console.trace()
fun.apply(this, args)
)
)
_.extend Backbone, Backbone.Events
View code.html
<!--#config timefmt="%s" --> <!-- 시간을 읽는 방법을 Unix Timestamp 로 설정 -->
<link href="/css/styles.css?<!--#flastmod virtual="/css/styles.css" -->" rel="stylesheet" type="text/css" /> <!-- last modified 타임을 GET 파라미터로 넘김 -->
<script type="text/javascript" src="/js/vendor/vendors.min.js?<!--#flastmod virtual="/js/vendor/vendors.min.js" -->"></script>
<script type="text/javascript" src="/js/app/common.min.js?<!--#flastmod virtual="/js/app/common.min.js" -->"></script>