Skip to content

Instantly share code, notes, and snippets.

View evanwhalen's full-sized avatar

Evan W evanwhalen

  • Austin
View GitHub Profile
@evanwhalen
evanwhalen / gist:f74879e0549b67eb17bb
Last active February 18, 2018 18:54
circleci-parallel-codeclimate
#!/usr/bin/env ruby
require "codeclimate-test-reporter"
branch = ENV['CIRCLE_BRANCH']
node_index = ENV['CIRCLE_NODE_INDEX'].to_i
node_total = ENV['CIRCLE_NODE_TOTAL'].to_i
artifacts_dir = ENV['CIRCLE_ARTIFACTS']
coverage_dir = File.join("..", "..", "..", ENV['CIRCLE_ARTIFACTS'], "coverage")
filename = '.resultset.json'
# in template
<%= form_tag subscription_path, id: 'payment-form' %>
<script>
$(function() {
var handler = StripeCheckout.configure({
key: "<%= Rails.configuration.stripe[:publishable_key] %>",
token: function(token, args) {
var form = $("#payment-form");
form.append("<input type='hidden' name='stripe_token' value='" + JSON.stringify(token) + "'/>");
@evanwhalen
evanwhalen / gist:5413605
Created April 18, 2013 15:23
Elasticsearch tire rspec filters
# Prevent calls from going out to elasticsearch unless we specify the example is an elasticsearch test
config.before :each do
unless (example.metadata[:elasticsearch] && example.metadata[:elasticsearch] == true)
stub_request(:any, %r|\Ahttp://.*9200.*|).to_return(:status => 200, :body => "{}")
end
end
config.before :each, elasticsearch: true do
[Product, User].each do |klass|
klass.index.delete
@evanwhalen
evanwhalen / gist:4155837
Created November 27, 2012 17:48
base job
class BaseJob
def queue
:queue
end
def perform(klass, method, *args)
klass.constantize.send(method, *args)
end
end