Skip to content

Instantly share code, notes, and snippets.

View gabeodess's full-sized avatar

Gabe Odess gabeodess

  • RigUp
  • Austin TX
  • 05:38 (UTC -05:00)
View GitHub Profile
@gabeodess
gabeodess / action_mailer.rb
Created February 3, 2015 05:43
Enabling ActionMailer previews in your production environment
# config/initializers/action_mailer.rb
class Rails::MailersController
protected
# The built in controller has a before_action call to :require_local! We override it here to enable use in production.
def require_local!
# I use the devise gem with active admin so I call authenticate_admin_user! so that only administrators are allowed to preview email templates.
@gabeodess
gabeodess / redis-to-go.txt
Last active August 29, 2015 14:15
Sidekiq on Heroku
# = General ==================================================================
port 10081
databases 1
loglevel notice
logfile /mnt/redis.330229.log
# = Security =================================================================
requirepass xxx
@gabeodess
gabeodess / subscription.rb
Last active August 29, 2015 14:16
Stubbing #save! and raising an exception with Mocha
class Subscription < ActiveRecord::Base
PRICING = {
1 => {
:small => 1300,
:medium => 1900,
:large => 2400
}.with_indifferent_access,
2 => {
:small => 16500,
$scope.$evalAsync(
function( ) {
$('body').append($('<div/>').html("{{coffee}}"))
}
);
$spring rake test test/integration/signup_test.rb
Run options: --seed 13906
# Running:
#(Element:0x3fe090fae7f8 {
name = "a",
attributes = [
#(Attr:0x3fe090fae014 {
name = "class",
Refused to display 'https://www.sharecoffeeroasters.com/facebook/contact/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
<form action="/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_1xBnoR7Mdwx4E1gD2dcgl8TL"
data-image="https://s3.amazonaws.com/stripe-uploads/acct_14qpC2GuKJ7VdKiHmerchant-icon-1419369420301-10846338_1510038909255594_3532245329824431014_n.jpg"
data-name="Share Coffee"
data-description="2 widgets"
data-amount="2000">
</script>
<input type='hidden' value='http://example.com/my-custom-url'/>
@gabeodess
gabeodess / Procfile
Created April 15, 2015 18:12
Sidekiq wont start custom queues
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
worker: bundle exec sidekiq -c 15 -v -C .config/sidekiq.yml -e $RAILS_ENV
@gabeodess
gabeodess / index.html
Created April 30, 2015 16:33
ngOptions
<select
name="coffee"
id="coffee"
class='form-control'
ng-model="subscription.great_coffees[$index]"
ng-options='coffee as coffee.name group by coffee.category_name for coffee in coffees track by coffee.id'
>
class String #:nodoc:
# =================
# = Class Methods =
# =================
def self.alphanumeric(length = 6)
(1..length).map{ [(0..9), ('a'..'z'), ('A'..'Z')].map(&:to_a).flatten.sample }.join
end
# ====================