Skip to content

Instantly share code, notes, and snippets.

View jkamenik's full-sized avatar

John Kamenik jkamenik

View GitHub Profile
@jkamenik
jkamenik / output.log
Created February 12, 2019 17:33
Terraform Failure
Initializing modules...
- module.cluster
Initializing provider plugins...
The following providers do not have any version constraints in configuration,
so the latest version was installed.
To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
describe "Bulk tagging" do
def verify_count(options)
options.each do |key,count|
expect(find("#results-#{key}")).to have_content count
end
end
def create_tag(tag, on:)
visit '/ip_taggings/create_many'
fill_in 'ips_and_fqdns', with: Array(on)
@jkamenik
jkamenik / csv-foreach
Created May 1, 2014 19:27
Performance testing CSV
#!/usr/bin/env ruby
require 'benchmark'
require 'csv'
file = ARGV.first
Benchmark.bm 40, 'total' do |x|
t1 = x.report "csv parse" do
CSV.parse(File.open(file), headers: true) do |row|
# get the 'pr' row
<form action="floodsmart.com/some/special/page" method="POST">
<!-- setup some redirects -->
<input type="hidden" name="error_redirect" value="http://waterfall/agent/1/unknown_error.html">
<input type="hidden" name="success_redirect" value="http://waterfall/agent/1/thankyou.html">
<!-- note the agents site -->
<input type="hidden" name="agent_id" value="something_unique">
<!-- actual form inputs go here -->
# put this in /lib/autoload
# Make sure /config/application.rb has a line `config.autoload_paths` which has /lib/autoload in it
module Gattica
class Engine
def do_http_get(query_string)
# fixes 1.9 compatibility with http
response = @http.get(query_string, @headers)
data = response.body
@jkamenik
jkamenik / Gemfile
Created June 11, 2013 20:40
Workaround for not being able to use BUNDLE_WITHOUT on Heroku cedar
unless ENV['HEROKU']
group :development, :test do
gem 'private gem', :git => git@github.com:private/repo
end
end
@jkamenik
jkamenik / category.feature
Created March 8, 2012 22:25
Factory Girl Tests
Scenario: Has no parents
Given the following categories exist:
| name |
| Foo |
| Bar |
| Baz |
Scenario: Nested tree
Given the following categories exist:
| name | parent |
class RegistrationsController < Devise::RegistrationsController
layout false
end
@jkamenik
jkamenik / install_firefox.sh
Created November 30, 2011 14:05
CI server using Firefox
$ sudo apt-get install firefox
@jkamenik
jkamenik / include.rb
Created November 21, 2011 21:43
Ruby module instance and class methods
module Foo
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def bar
end
end