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
<!doctype html> | |
<head> | |
<title>Achtergrond instellen ahv eerste keyword</title> | |
<style type="text/css"> | |
body { | |
height: 100%; | |
background: #e0e0e0 no-repeat center center fixed; | |
background-size: cover; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; |
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 Boolean | |
def self.from_json(value) | |
if value.is_a?(TrueClass) || value.is_a?(FalseClass) | |
return value | |
elsif value.is_a?(String) | |
return value == ("true" || "1") | |
elsif value.is_a?(Integer) | |
return value == 1 | |
else | |
nil |
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
# Put these modules and classes in separate files of course | |
module ToTree | |
# Module that will handle the conversion to a generic hashlike structure | |
# and also provides a common interface for model specific modules | |
def to_tree(uri_method) | |
self.tree_attributes.merge('url' => uri_method.call(self)) # We will use the method passed in from the controller to construct the url | |
end |
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
# In /lib/foo_bar_middleware.rb | |
class FooBarMiddleware | |
def initialize(app, options={}) | |
@app = app | |
# options will be {:foo => :bar} if you look lower down, you can use this in other methods etc | |
@options = options | |
end | |
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) }) | |
// prototype sprinkled with a bit of love (last command out of my head) | |
// Helpers to make JSON requests a bit cleaner. | |
Ajax.Json = { |