Skip to content

Instantly share code, notes, and snippets.

@pabloalr
pabloalr / README.md
Created August 29, 2024 03:07 — forked from simonc/README.md
find_each with ActiveResource

This is an example implementation of find_each with ActiveResource

Dependencies:

API:

  • has_scope

Client:

@pabloalr
pabloalr / filterable.rb
Created November 24, 2021 18:36 — forked from justinweiss/filterable.rb
Filterable
# 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
@pabloalr
pabloalr / css-grid-modern-responsive-dashboard.markdown
Created June 1, 2019 20:27
CSS Grid Modern Responsive Dashboard

Getting started

First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.

@pabloalr
pabloalr / gist:912715
Created April 10, 2011 20:57
simple accordion jquery plugin
/*
* (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>
*
@pabloalr
pabloalr / .vimrc
Last active December 6, 2022 15:01
syntax on
filetype on
filetype plugin on
filetype indent on
set tabstop=2
set ts=2
set softtabstop=2
set shiftwidth=2