Skip to content

Instantly share code, notes, and snippets.

View moo.fix.$type.js
/*
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';
View Events.oneShot.js
Events.implement('oneShot', function(evt, fx) {
function once() {
fx.run(arguments);
this.removeEvent(evt, once);
}
this.addEvent(evt, once);
});
View require.js
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
});
View mootools.1.3beta.document.id.margin.left.IE.glitch.html
<!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 Aug 6, 2010
Private mootator for mooTools 1.2.4
View Class.Mutators.Private.js
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];
View Class.Mutators.Profile.js
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 Mar 4, 2011
private pattern mutator for Mootools 1.3.x
View kenta.Private.js
/*
---
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 Oct 10, 2011
Class Profiler for Mootools 1.3.x
View kenta.AOP.Profile.js
/*
---
name: kenta.AOP.Profile.js
description: Profiling for MooTools 1.3
version: 1.0
license: MIT-style license.
View kenta.AOP.js
/*
---
name: kenta.AOP
description: AOP for MooTools 1.3
version: 1.1
license: MIT-style license.
View 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}})