Skip to content

Instantly share code, notes, and snippets.

View fabiomcosta's full-sized avatar
:octocat:
void 0

Fabio M. Costa fabiomcosta

:octocat:
void 0
View GitHub Profile
/*
Script: Date.Portuguese.BR.js
Date messages in Portuguese-BR. Thanks Fábio Miranda Costa.
License:
MIT-style license.
*/
MooTools.lang.set('pt-BR', 'Date', {
/*
* Inspired from http://github.com/jeresig/sizzle/commit/7631f9c3f85e5fa72ac51532399cb593c2cdc71f
* and this http://github.com/jeresig/sizzle/commit/5716360040a440041da19823964f96d025ca734b
* and then http://dev.jquery.com/ticket/4512
*/
Element.implement({
isHidden: function(){
var w = this.offsetWidth, h = this.offsetHeight,
Array.from = function(item, slice){
if(!item) return [];
if(!Type.isEnumerable(item)) return [item];
slice = slice || 0;
try{
return Array.prototype.slice.call(item, slice);
}
catch(e){
var l = item.length, array = new Array(l), i = slice;
for(; i < l; i++) array[i] = item[i];
var old = Array.from;
try {
old(document.html.childNodes);
} catch(e){
Array.from = function(item, slice){
if (typeOf(item) == 'collection'){
var l = item.length, array = new Array(l - slice), i = slice - 1;
while (++i < l) array[i] = item[i];
return array;
}
(function(){
var styleString = Element.getComputedStyle;
function styleNumber(element, style){
return styleString(element, style).toInt() || 0;
};
function isBody(element){
return (/^(?:body|html)$/i).test(element.tagName);
};
Element.implement({
getPosition: function(relative){
/*
Copyright (c) 2009 Rob Bast
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software
@fabiomcosta
fabiomcosta / runner.js
Created December 22, 2009 23:21
A Console Jasmine Runner
// a console object that outputs at the terminal
load('shell_console.js');
// makes jasmine-0.10.0 stop breaking
var window = this;
window.setTimeout = function(){};
window.setInterval = function(){};
window.clearTimeout = function(){};
window.clearInterval = function(){};
XMLHttpRequest = function(){};
// IE
var arrayFrom = Array.from;
try {
arrayFrom(document.html.childNodes);
} catch(e){
Array.from = function(item){
if (Type.isEnumerable(item)){
var i = item.length, array = new Array(i);
while (i--) array[i] = item[i];
return array;
/*
old delay function
delay: function(delay, bind, args){
return this.create({bind: bind, arguments: args, delay: delay})();
}
*/
/*
old delay function
delay: function(delay, bind, args){
return this.create({bind: bind, arguments: args, delay: delay})();
}
*/