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 / hubot_service.sh
Last active August 27, 2015 02:33 — forked from mattsgarrison/hubot_service.sh
Start/Stop script to manage Hubot with Monit
#!/bin/zsh
### BEGIN INIT INFO
# Provides: hubot
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the hubot service
# Description: starts the Hubot bot for the Campfire rooms
@braidn
braidn / 0_reuse_code.js
Created January 30, 2014 19:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
require 'csv'
namespace :quarterly do
desc 'CSV Up A Date Range of Cancelations'
task :cancelation_csv do |t, args|
s_date, e_date = DateTime.parse('jan 1, 2014'), DateTime.parse('jan 31, 2014')
binding.pry
build_csv(s_date, e_date)
d_date, m_date = DateTime.parse('jan 14, 2014'), DateTime.parse('jan 20, 2014')
build_csv(d_date, m_date)
end
/ The values should loop from 1 to whatever
/ Categories are pulled from the DB
.section.container.home-curators
%h3.section-title
\Popular curators:
.home-selecter
%select.not_custom
%option{:value => "1"}
\FASHION & STYLE
%option{:value => "2"}
module Quarterly
class CancelationsReport
class CancelationsPresenter < SimpleDelegator
def subscription_totals(start)
subscriptions.active.where("created_at < ?", start).count
end
def new_subscriptions(start, ending)
subscriptions.active.where("created_at between ? and ?",
@braidn
braidn / test.json
Created March 3, 2014 22:16
Test json
{
"payload": {
"text": "awesomesauce"
}
}
require 'stripe'
namespace :quarterly do
desc 'associate json file with existing users'
task json_to_stripe: :environment do
File.open("tmp/q_import.json", "r") do |file|
parsed_data = JSON.parse file.read
parsed_data['ids'].each do |id|
next if good_customer(stripe_account(id.last))
associate_with_stripe(stripe_account(id.last), spree_user_by_profile(id.first))
end
@braidn
braidn / find_me.sql
Created March 18, 2014 02:50
Users With CC's
User.joins('LEFT JOIN spree_credit_cards ON spree_users.payment_source_on_file_id = spree_credit_cards.id').where('spree_credit_cards.gateway_customer_profile_id like ?', "4%")
.F.F.F.F.F.F.F
Failures:
1) Spree::PaidOrderFactory given a valid credit card #create creates a shipment
Failure/Error: Unable to find matching line from backtrace
ActiveRecord::StatementInvalid:
PG::SyntaxError: ERROR: syntax error at or near "-"
LINE 1: SAVEPOINT active_record_-1
^

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: