Skip to content

Instantly share code, notes, and snippets.

View braidn's full-sized avatar
🏰
Storming

Braden Douglass braidn

🏰
Storming
View GitHub Profile
@braidn
braidn / .tmux.conf
Last active August 29, 2015 13:57
Tmux/Vim Config
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# environment settings
set-option -g default-shell /bin/zsh
set-environment -gu RBENV_VERSION
# set window index to start at 1
module Quarterly
class ApplicableRecipientsForIssueQuery
def initialize(issue, relation=Spree::User)
@issue = issue
@relation = relation
end
def call
@relation
.joins(:subscriptions)
@braidn
braidn / notify.sh
Created April 14, 2014 14:18
Appsignal Notify
cd $STACK_PATH
bundle exec appsignal notify_of_deploy -name="AppName" --environment=production --revision=`git log -1 --pretty=%H` --user=`git log -1 --pretty=%aN`
require 'spec_helper'
module Spree
describe PaidOrderFactory do
let(:user){ create(:quarterly_user) }
let(:address){ create(:address) }
let(:variant) {
create(:variant) do |v|
v.product.update_attributes!({shipping_category: shipping_category}, without_protection: true)
@braidn
braidn / sails_test.js
Created April 27, 2014 16:22
sails_testing
var assert = require('assert'),
Sails = require('sails'),
brarrels = require('barrels');
before(function(done) {
Sails.lift({
log: {
level: 'error'
},
adapters: {
@braidn
braidn / _google_analytics.html.erb
Created April 30, 2014 14:39
Google Analytics Quarterly
<% if tracker = Spree::Tracker.current %>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"></script>
<%= javascript_tag do %>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
@braidn
braidn / fancy-ctrl-z.sh
Created May 7, 2014 13:46
Ctrl Z to fg
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
fg
zle redisplay
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
module Quarterly
class CancelSubscriptionOrder
def subscription_canceled(sub, plan, user)
return unless sub.order
cancel_shipment(sub)
remove_line_item(sub)
cancel_order(sub)
cancel_payment_state(sub)
end
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 7)
working_directory "#{ENV['STACK_PATH']}"
listen "/tmp/web_server.sock", :backlog => 64
timeout 30
pid '/tmp/web_server.pid'
@braidn
braidn / redis.rb
Last active August 29, 2015 14:01
Redis Setup
$redis = Redis.new(:url => ENV['REDIS_URL'])