# npm install git://gist.github.com/4033566.git
# require('minispec') in your project
require('./minispec')
# use expect.js for assertion (http://n37.co/5gpfa)
expect = require('expect.js')
This file contains hidden or 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 singles = [ | |
| '', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', | |
| 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen' | |
| ]; | |
| var tenth = ['', 'ten', 'twenty', 'thirty', 'fourty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']; | |
| var unit = ['', 'thousand', 'million', 'billion']; | |
| module.exports = function (n) { | |
| var result = []; | |
| var len = n.toString().length; |
This file contains hidden or 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 singles = [ | |
| '', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', | |
| 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen' | |
| ]; | |
| var tenth = ['', 'ten', 'twenty', 'thirty', 'fourty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']; | |
| var unit = ['', 'thousand', 'million', 'billion']; | |
| module.exports = function (n) { | |
| var result = []; | |
| var len = n.toString().length; |
This file contains hidden or 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
| heroku apps:create [app-name] --remote [env name] | |
| than add --remote [env name] to execute command on env | |
| set the environment varible and addons | |
| ex: | |
| heroku config set XXX=OOO --remote [env name] | |
| heroku addons .... --remote [env name] |
This file contains hidden or 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
| web: node app.js |
This file contains hidden or 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 Robot = function(robot){ | |
| robot.turnLeft(robot.angle % 90); | |
| }; | |
| Robot.prototype.onIdle = function(ev) { | |
| var robot = ev.robot; | |
| if (robot.parentId) { | |
| robot.ahead(1); | |
| robot.turnGunRight(1); | |
| } | |
| else { |
This file contains hidden or 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
| reader = new FileReader() | |
| reader.onloadend = => | |
| reader.result | |
| reader.readAsDataURL event.target.files[0] | |
| reader = new FileReader() | |
| reader.onloadend = => | |
| $(event.target).prev('.image').attr 'src', reader.result |
This file contains hidden or 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
| 1. set user | |
| useradd -ms /bin/bash [username] | |
| passwd [username] | |
| hostname [NEW_NAME] | |
| 2. login in new user, install packages: | |
| sudo apt-get install apache2 php5 php5-mysql libapache2-mod-php5 apache2-mpm-prefork | |
| sudo apt-get install mysql-server mysql-client |
This file contains hidden or 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
| getAlgorithms = -> ['md5', 'sha1', 'sha256', 'sha512'] | |
| generateCode = (url, algorithms, digits, callback)-> | |
| #increase code digits if all codes are registered | |
| if algorithms.length is 0 | |
| algorithms = getAlgorithms() | |
| digits += 1 | |
| algorithm = algorithms.shift() |
This file contains hidden or 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
| HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008 | |
| Compiled by Eric Pement - eric [at] pement.org version 0.27 | |
| Latest version of this file (in English) is usually at: | |
| http://www.pement.org/awk/awk1line.txt | |
| This file will also be available in other languages: | |
| Chinese - http://ximix.org/translation/awk1line_zh-CN.txt | |
| USAGE: |