This is an example implementation of find_each with ActiveResource
- has_scope
| # 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 names based on the keys in <tt>filtering_params</tt> | |
| # with their associated values. For example, "{ status: 'delayed' }" would call |
A Pen by Matthew Holland on CodePen.
| /* | |
| * (c) 2011 Pablo Lerina | |
| * This code is provided as is with no warranty. | |
| * Feel free to use it as you wish. | |
| */ | |
| (function($) { | |
| $.fn.simpleAccordion = function(options) { | |
| var defaults = { | |
| scroll_to: true, |
| namespace :svn do | |
| desc "Add missing files to version control" | |
| task :add do | |
| svn_cmd = "svn status #{RAILS_ROOT} | grep ^? | awk '{ print $2 }'" | |
| puts "** [Exec] #{svn_cmd}" | |
| puts "" | |
| files = `#{svn_cmd}`.split("\n").reject { |file| file =~ /\/\./ } | |
| unless files.empty? | |
| puts "** The following files will be added:" | |
| puts files.map { |f| "\t#{f}" }.join("\n") |
| /* | |
| * This applet connect to a URL and send it's data to the local printer | |
| * specified by param printer_name. | |
| * | |
| * How to use it: | |
| * <applet code="printer" codebase="/" archive="printer.jar" width="100" height="100" id="printer_id"> | |
| * <param name="url" value="http://foo.bar.com/something.txt"/> | |
| * <param name="printer_name" value="My Printer"/> | |
| * </applet> | |
| * |
| syntax on | |
| filetype on | |
| filetype plugin on | |
| filetype indent on | |
| set tabstop=2 | |
| set ts=2 | |
| set softtabstop=2 | |
| set shiftwidth=2 |