Skip to content

Instantly share code, notes, and snippets.

@wesgarrison
wesgarrison / gist:5507124
Last active December 16, 2015 22:29
swedish chef
it "should be able login as a user" do
visit '/'
page.should have_content "Log In Here"
fill_in 'email', :with => user.email
fill_in 'password', :with => 'Password1'
click_button 'Log in'
end
Technical Error has occurred. Please Contact your agent.
Technical Details
Exception:
Type: com.farmers.frameworks.eagent.app.exception.CAPRequestException: Registration validation of policy and client number failed
Message: Registration validation of policy and client number failed
Trace: com.farmers.frameworks.eagent.app.exception.CAPRequestException: Registration validation of policy and client number failed at com.farmers.eagent.common.css.web.request.CSSExceptionReqHnd.initException(CSSExceptionReqHnd.java:45) at com.farmers.eagent.common.web.request.DefaultRequestMgr.dispatch(DefaultRequestMgr.java:183) at com.farmers.frameworks.eagent.web.ControllerServlet.performTask(ControllerServlet.java:209) at com.farmers.frameworks.eagent.web.ControllerServlet.performTask(ControllerServlet.java:186) at com.farmers.frameworks.eagent.web.ControllerServlet.doPost(ControllerServlet.java:163) at javax.servl
@wesgarrison
wesgarrison / gist:3921560
Created October 20, 2012 01:10
October 19 2012 - rubygems.org - notes on server

[transcript from http://www.youtube.com/watch?v=z73uiWKdJhw and irc]

Why is the server unhappy?

  • Bundle API is 70%-80% of traffic and it has to resolve the dependency graph and Marshal
  • x Processes are spinning in Ruby with 380% (of 400% total CPU [4 x 100%])
  • x Bundle can only use vanilla gems, so that's why we have to use Marshal
  • Redis Heapsize
  • Diskspace

Timing - middle of the day US

@wesgarrison
wesgarrison / order_decorator.rb
Created August 9, 2012 05:36
Overriding Spree tax calculations
# See http://guides.spreecommerce.com/logic_customization.html#extending-classes
# on where/how to use these
Spree::Order.class_eval do
def shipping_tax_zone
zone_address = ship_address
Spree::Zone.match(zone_address) || Spree::Zone.default_tax
end
def billing_tax_zone
# For the queasy, this is MIT licensed. See comment at the end.
module MySQLEncryption
# Mimics MySQL's AES_ENCRYPT() and AES_DECRYPT() encryption functions
def mysql_encrypt(s, key)
encrypt(s, mysql_key(key))
end
def mysql_decrypt(s, key)
@wesgarrison
wesgarrison / .bashrc
Created April 6, 2012 14:45
bashrc for new server setup
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@wesgarrison
wesgarrison / gist:1484362
Created December 16, 2011 03:46
Bookmarklet to remove zero entry lines from Harvest uninvoiced report
$$('tbody .btn-disabled').each(
function(element,index) {
element.up('tbody').hide()
}
);
$$('td.ur-name a.gray').each(
function(element,index){
element.up('tr').hide()
}
);
@pdf = Prawn::Document.new(skip_page_creation: true,
page_layout: :landscape,
page_size: 'LETTER',
margin: 0)
@pdf.start_new_page
@pdf.image "banner.jpg"
@pdf.render_file "test-prawn-fail.pdf"
@wesgarrison
wesgarrison / gist:1346170
Created November 7, 2011 21:01
mysql-slow.log
# Time: 111107 14:58:58
# Query_time: 21.900033 Lock_time: 0.000084 Rows_sent: 293622 Rows_examined: 293622
SET timestamp=1320699538;
SELECT * FROM `versions`;
$$('tbody .btn-disabled')
.each(function(element, index) {
element.up('tbody').hide()
});