Current Status: Still Investigating..
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
'use strict'; | |
var _cache = {}; | |
var microTemplate = function(str, data) { | |
var func = _cache[str]; | |
if (!func) { | |
var strFunc = | |
"var p=[],print=function(){p.push.apply(p,arguments);};" + | |
"with(obj){p.push('" + | |
//str.replace(/[\r\t\n]/g, " ") |
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 microTemplate = require(__dirname + '/micro-template.js'); | |
/******************************************************* | |
* `<%= %>` expression test | |
*******************************************************/ | |
var layout = [ | |
'<script type="text/html" id="item_tmpl">', | |
' <div id="<%=id%>" class="<%=(i % 2 == 1 ? " even" : "")%>">', | |
' <div class="grid_1 alpha right">', | |
' <img class="righted" src="<%=profile_image_url%>"/>', |
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 konsole = { | |
LOG_LEVELS: { | |
ALL: parseInt('11111',2), | |
DEBUG: parseInt('00001',2), | |
LOG: parseInt('00010',2), | |
INFO: parseInt('00100',2), | |
WARN: parseInt('01000',2), | |
ERROR: parseInt('10000',2), | |
NONE: parseInt('00000',2) | |
}, |
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
// ref. https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | |
function getStyle(elem, prop) { | |
var styles = window.getComputedStyle(elem, null); | |
var value = styles.getPropertyValue(prop); | |
if (!value) { | |
throw "Could not get style for " + prop; | |
} | |
return value | |
} |
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
# To use this, add .nvmrc with contents of 'N.N.N' to your project. e.g. 0.12.7 | |
# Add the following to the end of .bash_profile or .bashrc | |
# | |
# if directory is changed | |
# if `.nvmrc` is found execute `nvm use` | |
# if `package.json` is round execute `nvm use default` | |
enter_directory() { | |
if [ "$PWD" != "$PREV_PWD" ]; then | |
PREV_PWD="$PWD"; | |
if [ -e ".nvmrc" ]; then |
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 getDocumentPosition(oElement) { | |
var posX=0, posY=0; | |
if(oElement.offsetParent) { | |
for(;oElement; oElement = oElement.offsetParent) { | |
posX += oElement.offsetLeft; | |
posY += oElement.offsetTop; | |
} | |
return {x: posX, y: posY}; | |
} else { | |
return {x: oElement.x, y: oElement.y}; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="style.css"> | |
<script> | |
var previewFile; | |
window.onload = function() { | |
var canvas = document.querySelector("#canvas-to-resize"); |
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
#!/usr/bin/env node --harmony | |
var co = require('co'); | |
var prompt = require('co-prompt'); | |
var program = require('commander'); | |
program | |
.arguments('<file>') | |
.option('-u, --username <username>', 'The user to authenticate as') | |
.option('-p, --password <password>', 'The user\'s password') | |
.action(function(file) { |
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
{ | |
"name": "nodecmd", | |
"version": "0.0.3", | |
"description": "A command-line tool for creating command line tol", | |
"main": "index.js", | |
"bin": { | |
"snippet": "./index.js" | |
}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" |