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
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with the same name as the keys in <tt>filtering_params</tt> | |
# with their associated values. Most useful for calling named scopes from |
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
// Get all images | |
var images = document.getElementsByTagName('img'); | |
for (var i in images){ | |
var img = images[i]; | |
var height = img.height; | |
var width = img.width; | |
var url = "https://www.placecage.com/c/" + width + "/" + height; | |
// Replace an image src by the corresponding placecage url | |
img.setAttribute('src', url); | |
} |