Skip to content

Instantly share code, notes, and snippets.

// http://mooshell.net/tbdZW/
(function(){
var parseDimensions = function(element){
var array = element.get('class').match(/mooshell:[0-9]+:?([0-9]+)?/)[0].split(':');
var dimensions = { height: array[1] };
dimensions.width = (array[2]) ? dimensions.width = array[2] : '100%';
return dimensions;
};
var HashEvents = new Class({
Implements: [Options, Events],
options: {
/*
onChange: $empty,
*/
delimiter: '&',
poll: 200
@ryanflorence
ryanflorence / Class.Mutators.jQuery.js
Created February 21, 2010 06:49
With MooTools Native and Class modules you can write MooTools classes with jQuery
(function(){
Class.Mutators.jQuery = function(name){
var self = this;
jQuery.fn[name] = function(arg){
var args = Array.prototype.slice.call(arguments, 1);
if ($type(arg) == 'string'){
var instance = jQuery(this).data(name);
if (instance) instance[arg].apply(instance, args);
Class.Mutators.jQuery = function(name){
var self = this;
jQuery.fn[name] = function(arg){
if ($type(arg) == 'string'){
var instance = this.data(name);
if($type(instance[arg]) == 'function'){
var returns = instance[arg].apply(instance, Array.slice(arguments, 1));
return (returns == instance) ? this : returns;
}
if(arguments[1] != null){
@ryanflorence
ryanflorence / Database.js
Created March 7, 2010 18:21
Hypothetical HTML5 Database Interface with MooTools
// create a database
var myDB = new DB('html5_database_with_mootools',{
adapter: 'html5'
/*
// gears?
adapter: 'gears',
// node.js ?
adapter: 'MySQL'
user: 'root',
@ryanflorence
ryanflorence / Override.rb
Created March 16, 2010 18:18
Self-referential model with has_many :through, Rails
class Override < ActiveRecord::Base
belongs_to :recruiter, :class_name => "Rep"
belongs_to :signer, :class_name => "Rep"
end
// app reflects server-side pages
var App = {
Store: {
Index: {},
Product: {},
Category: {},
ContentPage: {}
}
};
['pushTest2', function(previous, next, duration, instance){
var distance = instance.element.getStyle('width').toInt();
next.setStyle('left', distance);
new Fx.Elements.start({
0: { left: [-distance] },
1: { left: [0] }
});
return this;
}],
/*!
* Copyright yayQuery Peoples, 2010
*
* Licensed under the MIT license
* http://www.opensource.org/licenses/mit-license.php
*
* This plugin is loosely based on Ben Almans BBQ Plugin, but without the extra fluff. Just
* plain onhashchange cross-browser support through jQuery Special Event API.
*
* http://yayquery.com/ - http://github.com/yayquery/
/*
---
script: Browser.Features.extras
description: Taken directly from jQuery 1.4.2 and adapted for MooTools. A collection of properties that represent the presence of different browser features or bugs.
license: MIT-style license.
authors: "The jQuery Core Developers", Ryan Florence (http://ryanflorence.com)