Skip to content

Instantly share code, notes, and snippets.

View mdoel's full-sized avatar

Mike Doel mdoel

View GitHub Profile
@mdoel
mdoel / schedule.txt
Last active February 5, 2018 18:04
Schedule Hack Night Taskpaper
Host Hack Night: @flagged @context(Connected) @autodone(true)
- Schedule in MeetUp @defer(Hack Night -10d 9:00) @due(Hack Night -7d)
- Tweet event URL
- Post event in Slack channels
- Invite people via email @due(Hack Night -3d)
- Retweet event URL @defer(Hack Night -1d 9:00) @due(Hack Night -1d 16:00)
- Order Pizza @defer(Hack Night 9:00) @due(Hack Night 15:00)
- Log expense in Harvest
- Schedule next Hack Night in Workflow @defer(Hack Night 21:00)
Load testing vs performance testing
A common mistake made in our industry is to conflate performance testing with
load testing. While both are important, neither is a substitute for the other.
The former helps assess whether a system is performant. Can it accomplish some
task in a short enough period of time to be effective? The latter is used to
understand how the performance changes as more and more demand is put on the
system. I came to appreciate the value of both while working for AOL back at
the time when 30 million people looked to that service as the way to get
@mdoel
mdoel / application_controller.rb
Created September 27, 2012 21:28
gross_application_controller
class ApplicationController < ActionController::Base
before_filter :set_pagination_defaults, :inline_file_downloads
protect_from_forgery
layout 'general'
def set_pagination_defaults
params[:page] ||= 1
params[:per_page] ||= 10
end
@mdoel
mdoel / mapform.js
Created September 7, 2011 18:51
How to unit test this
/* How does one unit test this? */
$(document).ready(function() {
$('#map-searchform .searchform-fields label').inFieldLabels();
$('#map-search-form').submit(function (e) {
e.preventDefault();
$('#map').map_control().find($('#map-search-terms').val());
});
});
@mdoel
mdoel / home.html.haml
Created June 5, 2011 22:45
how to get jquery into refinerycms?
- content_for :head_libraries, jquery_include_tags(:jquery_ui => false)
- content_for :head, javascript_include_tag('application')
.scrollable
.items
.homepage_slot.slot_1
= image_tag 'building.jpg'
.homepage_slot.slot_2
= image_tag 'alleluia.jpg'
.homepage_slot.slot_3
@mdoel
mdoel / backup.rake
Created May 2, 2011 20:04
Rake task to capture backup and upload to S3
require "heroku"
require "heroku/command"
require 'aws/s3'
namespace :backups do
desc "create a pg_dump and send to S3"
task :backup => :environment do
include RRBOUtil
@mdoel
mdoel / braintree_simulation_controller.rb
Created October 19, 2010 16:31
controller that simulates a Braintree gateway. The "trade" stuff was specific to our app, so update for your situation
class BraintreeSimulationController < ApplicationController
VALID_CC_NUMBERS = [ '4111111111111111', '5431111111111111', '6011601160116611', '341111111111111' ]
def transact
if params[:merchant_defined_field_1] == 'billing'
current_user.update_attributes( :bill_to_first_name => params[:firstname],
:bill_to_last_name => params[:lastname],
:bill_to_address => params[:address1],
:bill_to_address2 => params[:address2],
:bill_to_city => params[:city],
desc "Use Google to get and XML geocode response for address"
task :geocode => :environment do
require 'geokit'
address_str = ENV['address']
if address_str.nil?
puts "Usage: rake geocode address='address to geocode'"
end
url = "http://maps.google.com/maps/geo?q=#{Geokit::Inflector::url_escape(address_str)}&output=xml&key=#{Geokit::Geocoders::google}&oe=utf-8"
res = Net::HTTP.get_response(URI.parse(url))
puts res
class MockSuccess < Net::HTTPSuccess
def initialize
end
end
class MockFailure < Net::HTTPSuccess
def initialize
end
end