This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Request.Persistent = new Class({ | |
Extends: Request, | |
onStateChange: function(e) { | |
var patt = this.laststr; | |
this.laststr = this.xhr.responseText; | |
this.fireEvent('onUpdate', this.laststr.replace(patt, '')); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var working = false; //Not currening switching content. | |
var newBenefit = function(e) { | |
if (working) return false; | |
working = true; | |
e.stop(); | |
var cur = $$('#benefits .current')[0]; | |
if (cur) { | |
var el = this; | |
var next = $(el.get('href').split('#')[1]); | |
var mleft = cur.getElement('.photo').getStyle('margin-left'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element.implement({ | |
/* Adds a getArguments method to Elements that will extract the "arguments" of | |
forms. */ | |
getArguments: function(){ | |
var obj = {}; | |
this.getElements('input, select, textarea', true).each(function(el){ | |
var name = el.name, type = el.type, value = el.value; | |
if (value === false || !name || el.disabled) return; | |
$splat(value).each(function(val){ obj[name] = val; }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a onclick="if (confirm('Are you sure?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', '4e944db96e2da36bdf1af790b66bc5bfa67ef22b'); f.appendChild(s);f.submit(); };return false;" href="/bibliographies/1">Destroy</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
function check(e, selector, fn){ | |
var target = e.target, | |
els = this.getElements(selector), | |
isOverOut = /^(mouseover|mouseout)$/.test(e.type); | |
for (var i = els.length; i--; ){ | |
var el = els[i]; | |
if (el == target || el.hasChild(target)){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# Copyright (c) 2009 Michelle Steigerwalt <msteigerwalt.com> | |
# All rights reserved. | |
# | |
# Handy-dandy tea brewing timer for Maccies and Irssi. | |
# | |
# OSX Requirements: | |
# | |
# Uses Growl for messaging. Requires the Growl Perl modules. This could be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Listener class executes a logging function each time a method is called. | |
var Listener = new Class({ | |
listenStack: {}, | |
addListener: function(mth, fn) { | |
this.listenStack[mth] = this[mth]; | |
this[mth] = function() { | |
var rtrn = this.listenStack[mth].attempt(arguments); | |
fn(rtrn, arguments); | |
return rtrn; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Listener class executes a logging function each time a method is called. | |
var Spy = new Class({ | |
__spies: {}, | |
spyOn: function(mth, fn) { | |
this.__spies[mth] = this[mth]; | |
this[mth] = function() { | |
var rtrn = this.__spies[mth].attempt(arguments); | |
fn(rtrn, arguments); | |
return rtrn; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'); | |
var http = require('http'); | |
var url = require('url'); | |
require('./lib/MooTools'); | |
var Controllers = { | |
helloworld: { | |
echo: function(params,extraPath) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [1,2,3,4,5,6,7,8]; | |
Array.prototype.divide = function(segments) { | |
var response = []; | |
var size = Math.floor(this.length/segments); | |
for (var i=0;i<segments;i++) { | |
var start = i*size; | |
var end = start+size; | |
response.push(this.slice(start,end)); | |
} return response; |
OlderNewer