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,
/*!{id:msgpack.js,ver:1.05,license:"MIT",author:"uupaa.js@gmail.com"}*/
// === msgpack ===
// MessagePack -> http://msgpack.sourceforge.net/
this.msgpack || (function(globalScope) {
globalScope.msgpack = {
pack: msgpackpack, // msgpack.pack(data:Mix,
// toString:Boolean = false):ByteArray/ByteString/false
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;
}
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];
(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){
@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})();
}
*/