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
# 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 |
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
public class HttpDomainRoute | |
: HttpRoute | |
{ | |
private Regex domainRegex; | |
private Regex pathRegex; | |
public HttpDomainRoute(string domain, string routeTemplate, HttpRouteValueDictionary defaults, HttpRouteValueDictionary constraints) | |
: base(routeTemplate, defaults, constraints) | |
{ | |
this.Domain = domain; |
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
module CanCan | |
class Query | |
def sanitize_sql(conditions) | |
conditions | |
end | |
end | |
# customize to handle Mongoid queries in ability definitions conditions | |
class CanDefinition | |
def matches_conditions_hash?(subject, conditions = @conditions) |
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
Ever wondered how to login as another user within Devise? | |
Recently we had a feature request that would provide Admins with the ability | |
to sign is as another user. You could imagine live demonstrations or even production | |
support calls where you would like to be signed in as another user, yet not | |
have to ask for or decrypt their current password. After stewing for a bit, we found a | |
pretty nice solution with Devise. | |
Here's the Cucumber feature... |
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
ENV["WATCHR"] = "1" | |
system 'clear' | |
def growl(message) | |
growlnotify = `which growlnotify`.chomp | |
title = "Watchr Test Results" | |
puts message | |
image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" | |
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" | |
system %(#{growlnotify} #{options} &) |
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
#!/usr/bin/env ruby | |
# | |
# Put this script in your PATH and download from onemanga.com like this: | |
# onemanga_downloader.rb Bleach [chapter number] | |
# | |
# You will find the downloaded chapters under $HOME/Documents/OneManga/Bleach | |
# | |
# If you run this script without arguments, it will check your local manga downloads | |
# and check if there are any new chapters | |
# |
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
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 | |
################################################################################ |
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
# Hi! I'am rack middleware! | |
# I was born for protect you staging application from anonymous and prying | |
# My author's name was Aleksandr Koss. Mail him at kossnocorp@gmail.com | |
# Nice to MIT you! | |
class Staging | |
def initialize app, options = {} | |
@app = app | |
@options = { |
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
require 'net/http' | |
require 'uri' | |
require 'nokogiri' | |
class Pygrack | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
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
# Factory girl, relaxed. | |
# | |
# Factory.define :user do |f| | |
# f.login 'johndoe%d' # Sequence. | |
# f.email '%{login}@example.com' # Interpolate. | |
# f.password f.password_confirmation('foobar') # Chain. | |
# end | |
# | |
# Factory.define :post do |f| | |
# f.user { Factory :user } # Blocks, if you must. |
NewerOlder