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
// Code | |
Function.prototype.curry = function() { | |
var func = this, a = Array.prototype.slice.call(arguments, 0); | |
return function() { | |
var a_len = a.length, length = arguments.length; | |
while (length--) a[a_len + length] = arguments[length]; | |
return func.apply(this, a); | |
} | |
}; |
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
// See comments below. | |
// This code sample and justification brought to you by | |
// Isaac Z. Schlueter, aka isaacs | |
// standard style | |
var a = "ape", | |
b = "bat", | |
c = "cat", | |
d = "dog", |
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
var NoiseEeeCalendarDateSelect = Class.create(CalendarDateSelect, { | |
initialize: function($super, target_element, options) { | |
// something to observe for a custom event on `this` | |
$super(target_element, options); | |
} | |
}); | |
var dateSelect = new NoiseEeeCalendarDateSelect(); |
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
function select_towns(towns_string) { | |
var towns_arr = towns_string.split(','), | |
options = $$('#search_town_data option'); | |
towns_arr.each(function(town_id_string) { | |
options.select(function(opt) { | |
return opt.value.match(town_id_string); | |
}).invoke('writeAttribute','selected',true); | |
}); | |
} |
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
new Effect.Parallel([ | |
new Effect.BlindDown(area, {scaleFrom: 100, scaleTo: new_area_height_percentage }), | |
new Effect.Fade(element, { sync: true }), | |
new Effect.Appear(area.getElementsBySelector('.editor').first(), { sync: true, | |
afterSetup: function(effect) { | |
console.log(effect.element); | |
} | |
}) | |
], { ..... } | |
}); |
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
before_filter :ensure_https | |
def ensure_https | |
if Rails.env == "production" && !request.ssl? | |
redirect_to "https://" + request.host + request.request_uri | |
flash.keep | |
return false | |
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
<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
<html> | |
<head> | |
<script src="js/prototype.js" type="text/javascript"></script> | |
<script src="js/scriptaculous.js" type="text/javascript"></script> | |
<script> | |
document.observe('click', function(event){ | |
if(event.findElement().match('a.add_row')) { | |
event.stop(); | |
new Ajax.Request(this.href, { | |
onSuccess: function(transport){ |
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 |