Skip to content

Instantly share code, notes, and snippets.

/*
This is a fix for $type function to make it work with ActiveXObject too :) - optimized for size
*/
function $type(obj) {
if (obj == undefined) return false;
if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name;
if (obj.nodeName) {
switch (obj.nodeType) {
case 1: return 'element';
case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
Events.implement('oneShot', function(evt, fx) {
function once() {
fx.run(arguments);
this.removeEvent(evt, once);
}
this.addEvent(evt, once);
});
var require =(function(){
var imports = new Hash();
var path = "libs"
return function(lib){
if(!imports.has(lib)){
var req = new Request({
url:[path,lib].join('/') + ".js",
async:false
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
*{
margin:0;padding:0;border:0;
}
body {
font-size:1em;
}
@kentaromiura
kentaromiura / Class.Mutators.Private.js
Created August 6, 2010 09:04
Private mootator for mooTools 1.2.4
Class.Mutators.Private = function(private) {
var Private = {};
var me = this;
var imp = me.implement;
imp.apply(me, ['~', function() {
var uid = $uid(this);
private = null;
delete Private[uid];
Class.Mutators.Profile = function(uniqueID){
var imp = this.implement;
this.implement = function(key, value){
if($type(key) =='string' && $type(value) == 'function'){
var me = this;
var profile = function(){
var start = $time();
@kentaromiura
kentaromiura / kenta.Private.js
Created March 4, 2011 18:26
private pattern mutator for Mootools 1.3.x
/*
---
name: kenta.Private
description: Private mootator for MooTools 1.3.x
license: MIT-style license.
copyright: Carlesso Cristian http://mykenta.blogspot.com
@kentaromiura
kentaromiura / kenta.AOP.Profile.js
Created October 10, 2011 16:27
Class Profiler for Mootools 1.3.x
/*
---
name: kenta.AOP.Profile.js
description: Profiling for MooTools 1.3
version: 1.0
license: MIT-style license.
@kentaromiura
kentaromiura / kenta.AOP.js
Created October 11, 2011 16:50
AOP for Mootools
/*
---
name: kenta.AOP
description: AOP for MooTools 1.3
version: 1.1
license: MIT-style license.
@kentaromiura
kentaromiura / Monad.js
Last active December 11, 2015 02:38
Monad.js
(function(a){var b={},c=function(d){var e=b[d];if(!e){e=b[d]={};var f=e.exports={};a[d].call(f,c,e,f,window)}return e.exports};window.Monad=c("0")})({0:function(a,b,c,d){function e(a){if(a instanceof e)return a;this.value=function(){return a}}e.prototype.bind=function(a){var b=this.value();return a===e||b===null||b===undefined?this:typeof a=="function"?new e(a(b)):this},b.exports=e}})