Skip to content

Instantly share code, notes, and snippets.

View mattvague's full-sized avatar

Matt Vague mattvague

View GitHub Profile
@mattvague
mattvague / gist:1389605
Created November 23, 2011 19:15
Batch Action API
ActiveAdmin.register Post do
collection_action :favorite, :method => :post, :batch_action => true do
# DO STUFF
end
end
#vs.
ActiveAdmin.register Post do
batch_action :favorite do |selection|
@mattvague
mattvague / gist:1233433
Created September 21, 2011 21:55
Regex that matches any valid zip code or postal code
/(^\d{5}$)|(^\d{5}-\d{4}$)|(^[a-zA-Z]\d[a-zA-Z] ?\d[a-zA-Z]\d$)/i
@mattvague
mattvague / javascript_lint_spec.rb
Created July 4, 2011 23:33
Javascript Lint spec
require 'spec_helper'
require 'jslint'
describe "Javascript" do
before do
@lint = JSLint::Lint.new(
:paths => ['public/javascripts/**/*.js'],
:exclude_paths => ['public/javascripts/vendor/**/*.js'],
:config_path => 'spec/support/jslint.yml'