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 / index.html
Created September 18, 2014 13:24 — forked from anonymous/index.html
Angular Simple Todo App
<!DOCTYPE html>
<html ng-app='todoApp'>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<title>TO DO List</title>
</head>
@braidn
braidn / params.rb
Created September 24, 2014 19:24
PermittedCheckout Params
[:email, :use_billing, :shipping_method_id, :coupon_code, :special_instructions, {:bill_address_attributes=>[:firstname, :lastname, :address1, :address2, :city, :country_id, :state_id, :zipcode, :phone, :state_name, :alternative_phone, :company, {:country=>[:iso, :name, :iso3, :iso_name], :state=>[:name, :abbr]}], :ship_address_attributes=>[:firstname, :lastname, :address1, :address2, :city, :country_id, :state_id, :zipcode, :phone, :state_name, :alternative_phone, :company, {:country=>[:iso, :name, :iso3, :iso_name], :state=>[:name, :abbr]}], :payments_attributes=>[:amount, :payment_method_id, :payment_method, {:source_attributes=>[:number, :month, :year, :expiry, :verification_value, :first_name, :last_name, :cc_type, :gateway_customer_profile_id, :gateway_payment_profile_id, :last_digits, :name, :encrypted_data]}], :shipments_attributes=>[:order, :special_instructions, :stock_location_id, :id, :tracking, :address, :inventory_units, :selected_shipping_rate_id]}]
module Extensions
module Spree
module CheckoutCallbacks
extend ActiveSupport::Concern
included do
set_callback :updating_from_params, :after, :clear_empty_payment
def clear_empty_payment
#self in this case is the order object
module Spree
class Order
Checkout.module_eval do
set_callback :updating_from_params, :after, :clear_extra_payment
def clear_extra_payment
byebug
if self.payments && self.payments.count > 1
self.payments.last.delete
@braidn
braidn / better_search.rb
Created October 6, 2014 13:20
Ransack it
@all_products = @taxon.products.ransack(params[:q], available: true).result
@braidn
braidn / _prose.yml
Last active August 29, 2015 14:07
prose setup
---
prose:
rooturl: 'content/pages'
metadata:
content/pages:
- name: "link text"
field:
element: "text"
label: "Title"
value: ""
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/spec/expect'
require 'mocha/mini_test'
require "minitest/rails"
require 'mandrill_mailer/offline'
require 'minitest/reporters'
require 'ruby-jmeter'
require 'ffaker'
test do
threads 1, {continue_forever: false} do
defaults domain: URI('https://staging2.thereformation.com').host
cookies policy: 'rfc2109'
http_header_manager name: 'Accepts', value: 'application/json, text/javascript, text/html, */*'
visit name: 'Index', url: '/' do
extract name: 'csrf-token', xpath: "//meta[@name='csrf-token']/@content", tolerant: true
@braidn
braidn / metrics.md
Created November 5, 2014 22:25
List of augmented team metrics
  1. Time frame to get answers if asked over a chat application (hipchat/slack)
  2. Time frame for email responses or more asynchronous modes of conversations
  3. How many active collaborative items are used in house that are digital on a daily basis? (GitHub issues, Asana, Trello, etc)
  4. What percentage of the team communicates through these items daily, hourly?
  5. What percentage of the does not?
  6. How often is our team held up by the apposing team either through technical roadblocks or not?
  7. How well do we know the other team? What type of relationships were formed (very subjective)
require 'announcer'
# A factory to simplfy the creation of a paid order
#
module Spree
class PaidOrderFactory
include Announcer
def initialize(payment=nil)