Skip to content

Instantly share code, notes, and snippets.

View kevinvaldek's full-sized avatar

Kevin Valdek kevinvaldek

View GitHub Profile
/**
* Converts regular upload form to a nifty in place uploader (iFrame uploader).
* MooTools Class.
*/
var LiteUpload = new Class({
Implements: [Options, Events],
options: {
onUpload: $empty,
<div id="fellows" data-url="/fellows">
<!-- list of fellows -->
</div>
<div class="scrollcase" style="width: 3000px;">
<div rel="1st pane title">...</div>
<div rel="2nd pane title">...</div>
<div rel="3rd pane title">...</div>
</div>
function number_with_delimiter(number, delimiter) {
number = number + '', delimiter = delimiter || ',';
var split = number.split('.');
split[0] = split[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + delimiter);
return split.join('.');
};
// Test drive
var app = {
loader: new Loader(),
notice: new Notice(),
confirm: new Confirm(),
i18n: {
welcome: 'Tere tulemast'
}
}
app.loader.spin();
app.notice.fadeIn(app.i18n['welcome']);
app.confirm('This will open an alert dialog, proceed anyway?', function() { alert('Oh, no!'); });
1.send :+, 2
=> 3
class Fixnum; def +(other); 99; end; end
1 + 3
=> 99
class Fixnum; undef -; end
3 - 1
=> undefined method '-' for Fixnum (NoMethodError)
// prototype
new Ajax.Request("/your/mom", onSuccess: function(response) { $("lightbox_content").innerHTML = response.responseJSON.contents })
// jquery
$.getJSON("/your/mom", function(json) { $("#lightbox_content").html(json.contents) })
// mootools
new Request.JSON({ url: '/your/mom', onSuccess: function(json) { $('lightbox_content').set('html', json.contents) } })