Skip to content

Instantly share code, notes, and snippets.

View braidn's full-sized avatar
🏰
Storming

Braden Douglass braidn

🏰
Storming
View GitHub Profile
define [
"jquery"
"react"
"mixins/backbone"
"mixins/server_error"
"models/account"
"views/forms"
"views/account/account_nav"
module Spree
Taxon.class_eval do
include Spree::Redirectable
has_one :story
has_many :images, -> { order(:position) }, as: :viewable, dependent: :destroy,
class_name: 'Spree::Image'
def self.find_with_products input
find_by(permalink: input, taxonomy: Spree::Taxon.find_by(name: "Categories"))
module Spree
Order.instance_eval do
def find_by_number(number)
order = complete.where(number:number).take
order ||= where(number:number).take
end
def find_by_number!(number)
find_by_number(number)
end
@braidn
braidn / nginx.conf
Created January 5, 2015 15:55
nginx timeout
client_header_timeout 600;
client_body_timeout 600;
send_timeout 600;
proxy_read_timeout 600;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 600;
@braidn
braidn / testing.js
Last active August 29, 2015 14:14
GSO React Pres
var React = require('react/addons'),
Checkout = require('../components/checkout.js'),
TestUtils = React.addons.TestUtils;
describe('Checkout', function() {
var checkoutEl = TestUtils.renderIntoDocument(
<Checkout items={[{title: 'test'}, {title: 'test'}]} />
);
var items = TestUtils.scryRenderedDOMComponentsWithTag(checkoutEl, 'li');
var count = TestUtils.findRenderedDOMComponentWithTag(checkoutEl, 'span');
@braidn
braidn / jsx.js
Created January 28, 2015 22:03
GSO React Pres
var React = require('react');
var Checkout = React.createClass({
render: function () {
var listItems = this.props.items.map(function(item, i) {
return <li key={"selectedItem" + i}>{item.title}</li>
});
var count = listItems.length;
return (
<div>
@braidn
braidn / jsx-alt.coffee
Last active August 29, 2015 14:14
GSO React Press
{ div, input, ul, li, span } = React.DOM
Checkout = React.createClass
render: ->
listItems = this.props.items.map ->(item, i)
li key={"selectedItem" + i} {item.title}
count = listItems.length
return (
div, children: [
ul, children: [
{listItems}
@braidn
braidn / simple_class.js
Last active August 29, 2015 14:14
GSO React Press
var Photo = React.createClass({
render: function() {
return (
<img src='http://bukk.it/oprahs-bees.gif'/>
)
}
});
@braidn
braidn / output.sh
Created February 6, 2015 19:14
Running Specs/Test_app
Could not open library 'libgtk-x11-2.0': dlopen(libgtk-x11-2.0, 13): image not found.
Could not open library 'libgtk-x11-2.0.dylib': dlopen(libgtk-x11-2.0.dylib, 13): image not found.
Could not open library 'libgtk-x11-2.0.so.0': dlopen(libgtk-x11-2.0.so.0, 13): image not found.
Could not open library 'libgtk-x11-2.0.so.0.dylib': dlopen(libgtk-x11-2.0.so.0.dylib, 13): image not found.
Could not open library 'libgtk-x11-2.0.so': dlopen(libgtk-x11-2.0.so, 13): image not found.
Could not open library 'libgtk-x11-2.0.so.dylib': dlopen(libgtk-x11-2.0.so.dylib, 13): image not found.
Could not open library 'libgtk-3': dlopen(libgtk-3, 13): image not found.
Could not open library 'libgtk-3.dylib': dlopen(libgtk-3.dylib, 13): image not found.
Could not open library 'libgtk-3.so.0': dlopen(libgtk-3.so.0, 13): image not found.
Could not open library 'libgtk-3.so.0.dylib': dlopen(libgtk-3.so.0.dylib, 13): image not found.
@braidn
braidn / finder.rb
Created February 10, 2015 21:24
My Stuff
order.user.orders.complete.issues.
joins(line_items: {variant: {product: {issue: {}}}}).
where('quarterly_issues.plan_id = ?', order.product.subscription_plan.id).
map{|o| o.completed_at > order.completed_at}.include?(true)