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
--- 123d2pKhY1JNsNsc0bzw4L_37.vcl 2014-10-03 08:22:28.000000000 -0400 | |
+++ 123d2pKhY1JNsNsc0bzw4L_38.vcl 2014-10-03 08:22:03.000000000 -0400 | |
@@ -421,14 +421,21 @@ | |
# Header rewrite Whitelist Querystring : 10 | |
- set req.url = regsuball(req.url, "(?:(?<=[?&])(?!_escaped_fragment_|brand|branch|type|min_msrp|max_msrp|_type|keywords|page|per_page|tags|name|order_by|adid|return_url|event|classifications|zip|website_ids)[^&]+?)(?:&|$)", ""); | |
+ set req.url = regsuball(req.url, "(^|[\\?&]+)([^&\\/=]+(?:(&|$))|(?!_escaped_fragment_|brand|branch|type|min_msrp|max_msrp|_type|keywords|page|per_page|tags|name|order_by|adid|return_url|event|classifications|zip|website_ids\\b)[^&\\/=]+=[^&]+)", "&"); | |
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
# this tests a critical regex used in the 'Whitelist Query Params' config in | |
# Fastly, to transform request URLs into a normalized version that strips | |
# 'traffic partner' tracking params and other noise, but leaves any valid keys | |
# that match the params we actually use. A lot hinges on the proper operation | |
# of this regex to keep hit ratio high but leave needed params intact. | |
# | |
# This version leaves trailing ? and &, which is unavoidable now but are pulled | |
# out by a simple second sweep. | |
# | |
# http://regex101.com/r/oJ2gI6/10 |
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
class Foo | |
def self.with_enthusiasm | |
boring_old_methods = instance_methods(false) | |
yield | |
snazzy_new_methods = instance_methods(false) - boring_old_methods | |
snazzy_new_methods.each do |method| | |
method_without_chains = "#{method.to_s}_with_reset".to_sym | |
alias_method method_without_chains, method | |
define_method method do |*args| |
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
Spree::Variant.class_eval do | |
# find variants matching the given map of option_type.id's to option_value.id's | |
# and optionally limited to one product | |
# Spree::Variant.find_by_options {'4'=>'14','1'=>'3',2=>6, 3=>10}, product | |
def self.find_by_options opts={}, product=nil | |
sovv = Arel::Table.new :spree_option_values_variants | |
sot = Spree::OptionType.arel_table | |
sov = Spree::OptionValue.arel_table |
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
# select2_ajax helper to make capybara work with ajax-enabled Select2 elements | |
# assumes 'placeholder' option is used in Select2 (if it is using ajax, it should be) | |
# | |
# usage: | |
# | |
# it "should have a select2 field for searching by team name" do | |
# @team = Factory :team | |
# select2_ajax @team.name, :from => "Select a Team", :minlength => 4 | |
# click_button "Join" | |
# page.should have_content "You are now on '#{@team.name}'." |
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
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: thin | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: S 0 1 6 | |
# Short-Description: thin initscript | |
# Description: thin | |
### END INIT INFO |
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 "bundler/capistrano" # runs bundle:install on remote for us | |
# give cap the correct path to our custom installed rubies | |
default_environment['PATH'] = "/usr/local/ruby/bin:/usr/bin:/bin" | |
# ... rest of normal cap config |
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/perl -w | |
# Usage: randpw.pl <len> | |
# optional <len> truncate to so many chars | |
# using my copy of /usr/dict/words, n = 53970, so with default settings, r=2 and | |
# ((n+1)! / (r * (n-1)!) = 1456407435 (because its a duplicative combination at this stage) | |
# so there are | |
# (1456407435 * 1000 * 68)^3 = 9.7134 x 10^41 | |
# possible passwords here, |
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
/home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:506:in `rename': Not a directory - /home/sbeam/public_html/alpinehausct/tmp/cache/00020120110-11026-hr2o4s-0 or /home/sbeam/public_html/alpinehausct/tmp/cache/001/000/ (Errno::ENOTDIR) | |
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:506:in `mv' | |
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:1402:in `fu_each_src_dest' | |
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:1418:in `fu_each_src_dest0' | |
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:1400:in `fu_each_src_dest' | |
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:495:in `mv' | |
from /home/sbeam/.rvm/gems/ruby-1.8.7-p352@alpinehaus/gems/activesupport-3.1.3/lib/active_support/core_ext/file/atomic.rb:35:in `atomic_write' | |
from /home/sbeam/.rvm/gems/ruby-1.8.7-p352@alpinehaus/gems/activesupport-3.1.3/lib/active_support/cache/file_store.rb:102:in `write_entry' | |
from /home/sbeam/.rvm/ |
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
class SubscriptionsController < ApplicationController | |
def create | |
@subscription = Subscription.new params[:subscription] | |
@subscription.save | |
respond_to do |wants| | |
wants.js | |
wants.html | |
end |