This file contains 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
// everyone's new favorite closure pattern: | |
(function(window,document,undefined){ ... })(this,this.document); | |
// when minified: | |
(function(w,d,u){ ... })(this,this.document); | |
// which means all uses of window/document/undefined inside the closure | |
// will be single-lettered, so big gains in minification. | |
// it also will speed up scope chain traversal a tiny tiny little bit. |
This file contains 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
<div id="manageable_id_102" class="ep_manageable"> | |
<div class="ep_manageable_data"> | |
<input type="checkbox" name="bulkaction_eprintids" value="102" id="select-102" class="ep_resource_manager_select_check"> | |
<a href="http://resourcemanager.quango-vm.local/102/"><span class="ep_manageable_data_title">My New EdShare Resource</span></a> | |
<span class="ep_manageable_data_viewperms">Just me</span> | |
</div> | |
<div class="ep_manageable_controls"> | |
<ul> | |
<li><a href="http://resourcemanager.quango-vm.local/102/">View</a></li> | |
<li><a href="http://resourcemanager.quango-vm.local/cgi/users/home?screen=EPrint::Edit&eprintid=102">Edit</a></li> |
This file contains 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
##### | |
## INITIAL CONFIGURATION | |
##### | |
# Fork sstephenson/prototype on GitHub | |
# Go to this url and click the fork button. This will create a prototype | |
# repository under your GitHub account. | |
http://github.com/sstephenson/prototype |
This file contains 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
# Newbie Programmer | |
def factorial(x) | |
if x == 0 | |
return 1 | |
else | |
return x * factorial(x - 1) | |
end | |
end | |
puts factorial(6) | |
puts factorial(0) |
This file contains 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
//ported to prototype from http://www.csskarma.com/lab/slidinglabels/ | |
function formatSliderLabels(form) | |
{ | |
form = $(form); | |
var labelColor = '#999'; | |
var restingPosition = 5; | |
var topPosition = 6; | |
var duration = 0.2; | |
var labelAdjust = 10; | |
form.select('.slider label').each(function(el){ |
This file contains 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
# Created by Eric Lindvall <[email protected]> | |
# | |
# WHAT: Provides a simple overview of memory allocation occuring during a | |
# require. | |
# | |
# For a longer explanation, see my post at: | |
# | |
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby | |
# | |
# NOTE: The numbers provided are of self + children, meaning the same will |
This file contains 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
// Example | |
document.observe("lol:konami", function() { | |
$(document.body).insert(new Element('h1').update("KONAMI!!!").setStyle({fontWeight: "bold", color: "red"})); | |
}); |
This file contains 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.addMethods({ | |
viewable: function(el) { | |
// INIT | |
el = $(el); | |
var scroll = document.viewport.getScrollOffsets(); | |
var viewport = document.viewport.getDimensions(); | |
var offsets = el.cumulativeOffset(); | |
var dimensions = el.getDimensions(); | |
// Sanity check |
This file contains 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
namespace :db do | |
task :pull do | |
run "cd #{current_release} && RAILS_ENV=#{rails_env} rake db:data:dump" | |
download "#{current_release}/db/data.yml", "db/data.yml" | |
`rake db:reset db:data:load` | |
end | |
end |
This file contains 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
document.observeSelect = function(){ | |
$$('select.get').each(function(element){ | |
if(!element.observingChange){ | |
element.observe('change', function(event){ | |
var e = event.element(); | |
if(e.isActive()){ | |
e.indicate(); | |
document.ajaxRequest(e, e.readAttribute('src'), 'get', event, e.serialize()); | |
} | |
}); |