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
# lib/mongo_mapper/plugins/callbacks.rb | |
module MongoMapper | |
module Plugins | |
module Callbacks | |
module InstanceMethods | |
def self.included(model) | |
model.class_eval do | |
extend ActiveModel::Callbacks |
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
// 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) } }) |
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
class Fixnum; undef -; end | |
3 - 1 | |
=> undefined method '-' for Fixnum (NoMethodError) |
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
class Fixnum; def +(other); 99; end; end | |
1 + 3 | |
=> 99 |
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
1.send :+, 2 | |
=> 3 |
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
app.loader.spin(); | |
app.notice.fadeIn(app.i18n['welcome']); | |
app.confirm('This will open an alert dialog, proceed anyway?', function() { alert('Oh, no!'); }); |
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 app = { | |
loader: new Loader(), | |
notice: new Notice(), | |
confirm: new Confirm(), | |
i18n: { | |
welcome: 'Tere tulemast' | |
} | |
} |
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 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 |
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
<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> |
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
<div id="fellows" data-url="/fellows"> | |
<!-- list of fellows --> | |
</div> |