A preparation method for a tasty cup of kava, a traditional Polynesian tea
~20 minutes
/** Example module that supports CommonJS and IFFE modularity | |
* | |
* - CommonJS modules can be imported via `require` | |
* - IFFE modules attach themselves to the browser's window object | |
*/ | |
;( function ( factory ) { | |
// If the environment supports CommonJS modules, attach module to `module.exports` | |
if ( typeof require === 'function' && typeof exports === 'object' && typeof module === 'object' ) { | |
var target = module.exports || exports; |
function d(r){for(var e,n={},t=(r+'').split(''),o=t[0],c=o,d=[o],a=256,h=1; | |
h<t.length;h++){var M=t[h].charCodeAt(0); e=256>M?t[h]:n[M]?n[M]:c+o,d.push(e), | |
o=e.charAt(0),n[a]=c+o,a++,c=e}return d.join('')}d('MĀāĂ㥹ĆćĈĉć\nĊčĎďĐăČđĔĕĖ'+ | |
'ēĖęĚĈĘěĞğĝğĢėģĥĤĦĨďġĩĬąīĬ?ĭāįĉ..ZĐĶĶIJĴćĺ.Ď?ĿĶ:ĵŀĔĽąŃŇĈŋĀ ŌăłĶ~ đʼnă~MĿMıĆŐĿDă'+ | |
'ĻĂĺťĐŘţŃľūąŐŏŦă+ŖčũāŋŤťŃ8ņŹŊĸĉŶśŸŹ7ŎIJĄŶ7:ƄĻƄ+ƐƑƐāƒƕƓĀƕĀżĮĎƍ.ŠƞŭƃƍŷŜM,$ƜčơƬƢơ'+ | |
'ƥűċƫƭ+ŋIƣƱƢĄƺƪōƭĀƇƇƸŸưžƽƾƞDžƍŢǀljǍƱĆũƭŇơŴNJŬǐLJŊǓŀƬŪĺOǡǢǗĜĈƌǜŋŚŋ7NJǂƼƉǘǨŃŚǏűƯǵőǚƈ'+ | |
'ƈƂǻĠǾȀǽȀĚȂȃħȆĭȅȈŗȋȉȍĬ') |
/** | |
* LZW compression | |
* - https://gist.github.com/revolunet/843889 | |
* - http://pieroxy.net/blog/pages/lz-string/index.html | |
*/ | |
// LZW-compress a string | |
function lzw_encode(s) { | |
var dict = {}; | |
var data = (s + "").split(""); |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM?MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
How to actively develop and integration test a Node package within another Node package
Ideally, you'll want to develop your Node package in a self-contained way, thorugh unit testing and examples, independent from other packages. Sometimes, however, you'll want to develop your Node package within another package for integration testing purposes.
From your package directory, run npm link
. This will create a globally-installed symlink to your package.
cd ~/code/my-package
npm link
# Add this to your .bashrc/.profile to make Kirby dance in your command prompt! E.g., | |
# | |
# rob@hal ~ $ (>'.')> | |
# rob@hal ~ $ ^('.')^ | |
# rob@hal ~ $ <('.'<) | |
# rob@hal ~ $ ^('.')^ | |
# rob@hal ~ $ (>'.')> | |
# | |
# Moved from it's original location at http://pastebin.com/ftR6mtPg |
/** | |
* Make Kirby dance in your browser's JavaScript console. | |
* | |
* Great to run in your coworker's console when they forget to lock their computer. | |
*/ | |
var i = 0; | |
var KFRAMES = [ "<('.'<)", "^('.')^", "(>'.')>", "^('.')^" ]; | |
setInterval( function () { | |
clear(); | |
console.log( KFRAMES[ i % ( KFRAMES.length - 1 ) ] ); |