Skip to content

Instantly share code, notes, and snippets.

@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@justinweiss
justinweiss / filterable.rb
Last active January 11, 2024 07:28
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
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@myronmarston
myronmarston / subscription.rb
Created March 8, 2012 18:17
How we do migrations with Ripple
require 'versionable'
class Subscription
include Ripple::Document
include Versionable
current_schema_version 2
migrate_schema do |data|
self.schema_version = 2
@mikepack
mikepack / dci-rest-creation.rb
Created January 26, 2012 20:50 — forked from justinwiley/dci-rest-creation.rb
DCI + Rails new and create
# ---role
module BookManager
def create_book(attrs)
self.books.create! attrs
end
def update_book(book_id,attrs)
book = self.books.find(book_id)
book.update_attributes attrs
@rahul100885
rahul100885 / nginx.conf
Created October 14, 2011 08:33
Sample nginx file for web application with gzip and cache
user www-user;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
pid logs/nginx.pid;
@thilo
thilo / custom_steps.rb
Created June 4, 2010 09:33 — forked from terrainoob/custom_steps.rb
capybara with subdomains
Given /^I visit subdomain "(.+)"$/ do |sub|
#host! "#{sub}.example.com" #for webrat
Capybara.default_host = "#{sub}.example.com" #for Rack::Test
Capybara.app_host = "http://#{sub}.example.com:9887" if Capybara.current_driver == :culerity
################################################################################
# As far as I know, you have to put all the {sub}.example.com entries that you're
# using in your /etc/hosts file for the Culerity tests. This didn't seem to be
# required for Rack::Test
################################################################################