Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Created July 18, 2013 17:40
Show Gist options
  • Save max-mapper/6031313 to your computer and use it in GitHub Desktop.
Save max-mapper/6031313 to your computer and use it in GitHub Desktop.
requirebin sketch
var reverse = require('ascii-art-reverse')
// makes a visible HTML console
require('console-log').show(true)
var coolbear =
" ('-^-/') \n" +
" `o__o' ] \n" +
" (_Y_) _/ \n" +
" _..`--'-.`, \n" +
" (__)_,--(__) \n" +
" 7: ; 1 \n" +
" _/,`-.-' : \n" +
" (_,)-~~(_,) \n";
setInterval(function() { console.log(coolbear) }, 1000)
setTimeout(function() {
setInterval(function() { console.log(reverse(coolbear)) }, 1000)
}, 500)
require=function(e,t,n){function r(n,i){if(!t[n]){if(!e[n]){var u="function"==typeof require&&require;if(!i&&u)return u(n,!0);if(o)return o(n,!0);throw Error("Cannot find module '"+n+"'")}var s=t[n]={exports:{}};e[n][0].call(s.exports,function(t){var o=e[n][1][t];return r(o?o:t)},s,s.exports)}return t[n].exports}for(var o="function"==typeof require&&require,i=0;n.length>i;i++)r(n[i]);return r}({"ascii-art-reverse":[function(e,t){t.exports=e("is7NeG")},{}],is7NeG:[function(e,t){"use strict";function n(e,t){i.readFile(e,function(e,n){if(e)return t(e);var o=""+n,i=r(o);t(null,i,o)})}function r(e){e=e.replace("\r\n","\n").split("\n");var t=e.reduce(function(e,t){return Math.max(t.length,e)},0),e=e.map(function(e){var n=Array(1+t-e.length).join(" ");return e=o(e+n),e.replace(/\s\+$/,"")}).join("\n");return e}function o(e){for(var t="",n=e.length-1;n>=0;--n)t+=u.hasOwnProperty(e[n])?u[e[n]]:e[n];return t}var i=e("fs"),u={b:"d",d:"b",z:"s","(":")",")":"(","[":"]","]":"[","{":"}","}":"{","<":">",">":"<","/":"\\","\\":"/"};t.exports=r,r.reverseArtFile=n},{fs:1}],1:[function(){},{}]},{},[]),require=function(e,t,n){function r(n,i){if(!t[n]){if(!e[n]){var u="function"==typeof require&&require;if(!i&&u)return u(n,!0);if(o)return o(n,!0);throw Error("Cannot find module '"+n+"'")}var s=t[n]={exports:{}};e[n][0].call(s.exports,function(t){var o=e[n][1][t];return r(o?o:t)},s,s.exports)}return t[n].exports}for(var o="function"==typeof require&&require,i=0;n.length>i;i++)r(n[i]);return r}({"console-log":[function(e,t){t.exports=e("hh3Cj5")},{}],hh3Cj5:[function(e,t){function n(e){var t=console[e];console[e]=function(){var e=[].slice.call(arguments);u.write(e),t.apply(console,e)}}var r=e("./widget"),o=e("observable"),i=e("hyperscript");"undefined"==typeof console&&(globals.console={},console.log=function(){},console.error=function(){});var u=r({style:{height:"400px",width:"200px","border-bottom":"1px dotted black"}});n("log"),n("error"),window.addEventListener("error",function(e){u.write([e.stack])}),document.body.appendChild(i("div",{style:{background:"white",border:"1px solid black",position:"fixed",right:"20px",bottom:"20px"}},u.element,i("div",o.boolean(u.show,">","<"),{onclick:function(){u.show(!u.show())}},{style:{margin:"10px","min-width":"20px","min-height":"20px","text-align":"center"}}))),u.show(!1),t.exports=u},{"./widget":1,observable:2,hyperscript:3}],2:[function(e,t){(function(){function e(e,t){e(t()),t(e)}function n(e,t){t(e()),e(t),t(e)}function r(e){return void 0===e}function o(e){return"function"!=typeof e}function i(e,t){for(var n in e)e[n](t)}function u(e,t){delete e[e.indexOf(t)]}function s(e,t,n){(e.on||e.addEventListener).call(e,t,n,!1)}function c(e,t,n){(e.removeListener||e.removeEventListener||e.off).call(e,t,n,!1)}function a(){var e,t=[];return function(n){return r(n)?e:o(n)?i(t,e=n):(t.push(n),function(){u(t,n)})}}function f(e,t){return function(n){return r(n)?e.get(t):o(n)?e.set(t,n):(s(e,"change:"+t,n),function(){c(e,"change:"+t,n)})}}function l(e,t,n){if("function"!=typeof e)throw Error("transform expects an observable");return function(i){return r(i)?t(e()):o(i)?e((n||t)(i)):e(function(e){i(t(e))})}}function p(e){return l(e,function(e){return!e})}function v(e,t,n,r){function o(){r("function"==typeof n?n():e[n])}return s(e,t,o),function(){c(e,t,o)}}function h(e,t,n){return t=t||"value",n=n||"input",function(i){return r(i)?e[t]:o(i)?e[t]=i:v(e,n,t,i)}}function d(e){function t(){return e[e.selectedIndex].value}function n(t){for(var n=0;e.options.length>n;n++)e.options[n].value==t&&(e.selectedIndex=n)}return function(i){return r(i)?e.options[e.selectedIndex].value:o(i)?n(i):v(e,"change",t,i)}}function g(e,t,n){var i=!1;return function(u){function a(){i||u(i=!0)}function f(){i&&u(i=!1)}return r(u)?i:o(u)?void 0:(s(e,t,a),s(e,n||t,f),function(){c(e,t,a),c(e,n||t,f)})}}function y(e){throw Error(e)}function m(e,t){function n(){return t.apply(null,e.map(function(e){return e()}))}return function(t){return r(t)?n():o(t)?y("read-only"):e.forEach(function(e){e(function(){t(n())})})}}function w(e,t,n){return l(e,function(e){return e?t:n},function(e){return e==t?!0:!1})}var b=a;b.bind1=e,b.bind2=n,b.value=a,b.not=p,b.property=f,b.input=b.attribute=h,b.select=d,b.compute=m,b.transform=l,b.boolean=w,b.toggle=g,b.hover=function(e){return g(e,"mouseover","mouseout")},b.focus=function(e){return g(e,"focus","blur")},"object"==typeof t?t.exports=b:this.observable=b})()},{}],4:[function(e,t){var n=t.exports={};n.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){if(e.source===window&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var t=n.shift();t()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw Error("process.chdir is not supported")}},{}],5:[function(e,t,n){(function(e){function t(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;e.length>n;n++)if(t===e[n])return n;return-1}e.EventEmitter||(e.EventEmitter=function(){});var r=n.EventEmitter=e.EventEmitter,o="function"==typeof Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=10;r.prototype.setMaxListeners=function(e){this._events||(this._events={}),this._events.maxListeners=e},r.prototype.emit=function(e){if("error"===e&&(!this._events||!this._events.error||o(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var t=this._events[e];if(!t)return!1;if("function"==typeof t){switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:var n=Array.prototype.slice.call(arguments,1);t.apply(this,n)}return!0}if(o(t)){for(var n=Array.prototype.slice.call(arguments,1),r=t.slice(),i=0,u=r.length;u>i;i++)r[i].apply(this,n);return!0}return!1},r.prototype.addListener=function(e,t){if("function"!=typeof t)throw Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",e,t),this._events[e])if(o(this._events[e])){if(!this._events[e].warned){var n;n=void 0!==this._events.maxListeners?this._events.maxListeners:i,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}this._events[e].push(t)}else this._events[e]=[this._events[e],t];else this._events[e]=t;return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){var n=this;return n.on(e,function r(){n.removeListener(e,r),t.apply(this,arguments)}),this},r.prototype.removeListener=function(e,n){if("function"!=typeof n)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[e])return this;var r=this._events[e];if(o(r)){var i=t(r,n);if(0>i)return this;r.splice(i,1),0==r.length&&delete this._events[e]}else this._events[e]===n&&delete this._events[e];return this},r.prototype.removeAllListeners=function(e){return 0===arguments.length?(this._events={},this):(e&&this._events&&this._events[e]&&(this._events[e]=null),this)},r.prototype.listeners=function(e){return this._events||(this._events={}),this._events[e]||(this._events[e]=[]),o(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]}})(e("__browserify_process"))},{__browserify_process:4}],1:[function(e,t){var n=e("events").EventEmitter,r=e("hyperscript"),o=e("observable");console.log,t.exports=function(e){e=e||{};var t=new n,i=!0;e.max=1e4,e.margin=e.margin||30,e.style=e.style||{height:"100%",width:"50%"},e.template=e.template||function(e){return r("pre",e.map(function(e,t){if(!t)return e+"";try{return JSON.stringify(e,!1,2)}catch(e){return e+""}}).join(" "))},t.show=o();var u=r("div"),s=r("div",{style:e.style},{style:{overflow:"scroll",display:o.boolean(t.show,"block","none")}},u);return t.follow=function(){var e=u.lastElementChild;e&&e.scrollIntoViewIfNeeded(),i=!0},t.show(function(e){e&&i&&t.follow()}),t.show(!0),t.end=function(){},t.writable=!0,t.log=t.write=function(n){var r=e.template(n),o=u.getBoundingClientRect().bottom,c=s.getBoundingClientRect().bottom;if(i=c+e.margin>o,u.appendChild(r),i&&t.show()){for(;u.clientHeight>e.max&&u.children.length;)u.removeChild(u.firstChild);r.scrollIntoViewIfNeeded()}return!0},t.element=s,t}},{events:5,hyperscript:3,observable:2}],3:[function(e,t){function n(){function e(t){function a(e){var t=u(e,/([\.#]?[a-zA-Z0-9_-]+)/);o(t,function(e){var t=e.substring(1,e.length);e&&(n?"."===e[0]?s(n).add(t):"#"===e[0]&&n.setAttribute("id",t):n=document.createElement(e))})}var f;if(null==t);else if("string"==typeof t)n?n.appendChild(f=document.createTextNode(t)):a(t);else if("number"==typeof t||"boolean"==typeof t||t instanceof Date||t instanceof RegExp)n.appendChild(f=document.createTextNode(""+t));else if(i(t))o(t,e);else if(r(t))n.appendChild(f=t);else if(t instanceof Text)n.appendChild(f=t);else if("object"==typeof t)for(var l in t)if("function"==typeof t[l])/^on\w+/.test(l)?n.addEventListener?n.addEventListener(l.substring(2),t[l]):n.attachEvent(l,t[l]):(n[l]=t[l](),t[l](function(e){n[l]=e}));else if("style"===l)for(var p in t[l])(function(e,r){"function"==typeof r?(n.style.setProperty(e,r()),r(function(t){n.style.setProperty(e,t)})):n.style.setProperty(e,t[l][e])})(p,t[l][p]);else"data-"===l.substr(0,5)?c(n)[l.substr(5)]=t[l]:n[l]=t[l];else if("function"==typeof t){var v=t();n.appendChild(f=r(v)?v:document.createTextNode(v)),t(function(e){r(e)&&f.parentElement?(f.parentElement.replaceChild(e,f),f=e):f.textContent=e})}return f}for(var t=[].slice.call(arguments),n=null;t.length;)e(t.shift());return n}function r(e){return e&&e.nodeName&&e.nodeType}function o(e,t){if(e.forEach)return e.forEach(t);for(var n=0;e.length>n;n++)t(e[n],n)}function i(e){return"[object Array]"==Object.prototype.toString.call(e)}var u=e("browser-split"),s=e("class-list"),c=e("data-set");t.exports=n},{"browser-split":6,"class-list":7,"data-set":8}],6:[function(e,t){(function(){t.exports=function(e){var t,n=String.prototype.split,r=/()??/.exec("")[1]===e;return t=function(t,o,i){if("[object RegExp]"!==Object.prototype.toString.call(o))return n.call(t,o,i);var u,s,c,a,f=[],l=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.extended?"x":"")+(o.sticky?"y":""),p=0,o=RegExp(o.source,l+"g");for(t+="",r||(u=RegExp("^"+o.source+"$(?!\\s)",l)),i=i===e?-1>>>0:i>>>0;(s=o.exec(t))&&(c=s.index+s[0].length,!(c>p&&(f.push(t.slice(p,s.index)),!r&&s.length>1&&s[0].replace(u,function(){for(var t=1;arguments.length-2>t;t++)arguments[t]===e&&(s[t]=e)}),s.length>1&&s.index<t.length&&Array.prototype.push.apply(f,s.slice(1)),a=s[0].length,p=c,f.length>=i)));)o.lastIndex===s.index&&o.lastIndex++;return p===t.length?(a||!o.test(""))&&f.push(""):f.push(t.slice(p)),f.length>i?f.slice(0,i):f}}()})()},{}],7:[function(e,t){function n(e){function t(e){var t=f();i(t,e)>-1||(t.push(e),l(t))}function n(e){var t=f(),n=i(t,e);-1!==n&&(t.splice(n,1),l(t))}function u(e){return i(f(),e)>-1}function s(e){return u(e)?(n(e),!1):(t(e),!0)}function c(){return e.className}function a(e){var t=f();return t[e]||null}function f(){var t=e.className;return r(t.split(" "),o)}function l(t){var n=t.length;e.className=t.join(" "),v.length=n;for(var r=0;t.length>r;r++)v[r]=t[r];delete t[n]}var p=e.classList;if(p)return p;var v={add:t,remove:n,contains:u,toggle:s,toString:c,length:0,item:a};return v}function r(e,t){for(var n=[],r=0;e.length>r;r++)t(e[r])&&n.push(e[r]);return n}function o(e){return!!e}var i=e("indexof");t.exports=n},{indexof:9}],8:[function(e,t){function n(e){if(e.dataset)return e.dataset;var t=u.get(e);return t||(t=r(e),u.set(e,t)),t}function r(e){var t=e.attributes,n={};if(null===t||void 0===t)return n;for(var r=0;t.length>r;r++){var o=t[r];"data-"===o.name.substr(0,5)&&(n[o.name.substr(5)]=o.value)}return n}var o=e("weakmap"),i=e("individual"),u=i("__DATA_SET_WEAKMAP",o());t.exports=n},{weakmap:10,individual:11}],10:[function(e,t,n){(function(){void function(e,r,o){function i(e,t,n){return"function"==typeof t&&(n=t,t=u(n).replace(/_$/,"")),a(e,t,{configurable:!0,writable:!0,value:n})}function u(e){return"function"!=typeof e?"":"name"in e?e.name:f.call(e).match(v)[1]}function s(e){function t(t,r){return r||2===arguments.length?n.set(t,r):(r=n.get(t),r===o&&(r=e(t),n.set(t,r))),r}var n=new d;return e||(e=g),t}var c=Object.getOwnPropertyNames,a=Object.defineProperty,f=Function.prototype.toString,l=Object.create,p=Object.prototype.hasOwnProperty,v=/^\n?function\s?(\w*)?_?\(/,h=function(){function e(){var e=u(),r={};this.unlock=function(o){var i=f(o);if(p.call(i,e))return i[e](r);var u=l(null,t);return a(i,e,{value:Function("s","l",n)(r,u)}),u}}var t={value:{writable:!0,value:o}},n="return function(k){if(k===s)return l}",r=l(null),u=function(){var e=Math.random().toString(36).slice(2);return e in r?u():r[e]=e},s=u(),f=function(e){if(p.call(e,s))return e[s];if(!Object.isExtensible(e))throw new TypeError("Object must be extensible");var t=l(null);return a(e,s,{value:t}),t};return i(Object,function(e){var t=c(e);return p.call(e,s)&&t.splice(t.indexOf(s),1),t}),i(e.prototype,function(e){return this.unlock(e).value}),i(e.prototype,function(e,t){this.unlock(e).value=t}),e}(),d=function(t){function n(t){return this===e||null==this||this===n.prototype?new n(t):(v(this,new h),g(this,t),o)}function s(e){p(e);var t=d(this).get(e);return t===r?o:t}function c(e,t){p(e),d(this).set(e,t===o?r:t)}function a(e){return p(e),d(this).get(e)!==o}function f(e){p(e);var t=d(this),n=t.get(e)!==o;return t.set(e,o),n}function l(){return d(this),"[object WeakMap]"}var p=function(e){if(null==e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Invalid WeakMap key")},v=function(e,n){var r=t.unlock(e);if(r.value)throw new TypeError("Object is already a WeakMap");r.value=n},d=function(e){var n=t.unlock(e).value;if(!n)throw new TypeError("WeakMap is not generic");return n},g=function(e,t){null!==t&&"object"==typeof t&&"function"==typeof t.forEach&&t.forEach(function(n,r){n instanceof Array&&2===n.length&&c.call(e,t[r][0],t[r][1])})};try{var y=("return "+f).replace("e_","\\u0065"),m=Function("unwrap","validate",y)(d,p)}catch(w){var m=f}var y=(""+Object).split("Object"),b=function l(){return y[0]+u(this)+y[1]};i(b,b);var x={__proto__:[]}instanceof Array?function(e){e.__proto__=b}:function(e){i(e,b)};return x(n),[l,s,c,a,m].forEach(function(e){i(n.prototype,e),x(e)}),n}(new h),g=Object.create?function(){return Object.create(null)}:function(){return{}};t!==o?t.exports=d:n!==o?n.WeakMap=d:"WeakMap"in e||(e.WeakMap=d),d.createStorage=s,e.WeakMap&&(e.WeakMap.createStorage=s)}((0,eval)("this"))})()},{}],9:[function(e,t){var n=[].indexOf;t.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;e.length>r;++r)if(e[r]===t)return r;return-1}},{}],11:[function(e,t){(function(){function n(e,t){return r[e]?r[e]:(Object.defineProperty(r,e,{value:t,configurable:!0}),t)}var r=e("global");t.exports=n})()},{global:12}],12:[function(e,t){(function(e){e!==void 0?t.exports=e:"undefined"!=typeof window&&(t.exports=window)})(self)},{}]},{},[]);var reverse=require("ascii-art-reverse");require("console-log").show(!0);var coolbear=" ('-^-/') \n `o__o' ] \n (_Y_) _/ \n _..`--'-.`, \n (__)_,--(__) \n 7: ; 1 \n _/,`-.-' : \n (_,)-~~(_,) \n";setInterval(function(){console.log(coolbear)},1e3),setTimeout(function(){setInterval(function(){console.log(reverse(coolbear))},1e3)},500);
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment