Skip to content

Instantly share code, notes, and snippets.

@amark
amark / is
Last active December 21, 2015 11:19
a more english way to check type with theory.
;module.exports=require('theory')
('is', function(a){
return function(what){
return {
binary: a.bi.is(what)
,number: a.num.is(what)
,text: a.text.is(what)
,list: a.list.is(what)
,object: a.obj.is(what)
,func: a.fns.is(what)
@amark
amark / imports
Created August 21, 2013 07:46
Require that works everywhere, tested on all browsers IE6 or more modern and Node! Weighs 2KB. Save this file as "imports.js", then include it as a script tag for the browser, and use as below for your own code - Node works automatically. `;module.exports=require('./path/to/imports')('hello',function(mods){ /* your code here */ return 'Hello Wor…
(function(){var m=m||{},g=m,a={id:"imports"};g.opts=g.opts||{};g.d={l:{},n:{},a:{},w:{}};g.z="undefined"!==typeof GLOBAL&&GLOBAL.global&&GLOBAL.process&&GLOBAL.process.env&&GLOBAL.process.pid&&GLOBAL.process.execPath?function(){global.node=g.node=!0;module.exports=function(b,e,d){var c=a.r(b,e,d);c.s=g.y||(module.parent||{}).filename;a.e(a.d(c.d,c.s,{}),function(b,e){c.a[b]=a.n(e=require(g.y=e))?void 0:e});return c.i(c.a)}}:function(){var b=window;g.page=!0;b.root=g;b.console=b.console||{log:function(a){return a}};
location.local="file:"===location.protocol?"http:":"";b.__dirname="";b.module={exports:b.exports={}};a.l=function(a,b){var c="script",f=document.createElement(c);module.sync=null!==f.onload&&f.readyState?1:0;var h=2166136261,g=a.length,k=b,q=/=\?/,r=window.setTimeout,n,m,p=function(a){document.body&&(a=a||n)&&f&&document.body[a]?document.body[m=a](f):r(p,0)};if(q.test(a)){for(;g--;)h=16777619*h^a.charCodeAt(g);window[c+=0>h?-h:h]=function(){k.apply(k,arguments);delete window[c]};a=a.replace(q,"="+