This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
// Arrays | |
$.inject = function(array, memo, fn) { | |
for(var i = 0; i < array.length; i++) | |
memo = fn(memo, array[i]); | |
return memo; | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Files (not deleted) in the index | |
files=$(git diff-index --name-status --cached HEAD | grep -v ^D | cut -c3-) | |
if [ "$files" != "" ] | |
then | |
for f in $files | |
do | |
# Only examine known text files | |
if [[ "$f" =~ [.](conf|css|erb|html|js|json|log|properties|rb|ru|txt|xml|yml)$ ]] | |
then | |
# Add a linebreak to the file if it doesn't have one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Controller - Application service layer until a separation has clear value | |
# | |
# | |
class CartController < ApplicationController | |
before_filter :find_variant | |
rescue_from Model::InvalidOperation, with: :domain_error | |
def add_item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sunspot.session = CoreShardingSessionProxy.new(Sunspot.config) | |
# Causes error | |
# /Users/bcrouse/.rvm/gems/ruby-1.9.2-p0@solr_plexus/gems/sunspot-1.2.1/lib/sunspot/session_proxy/abstract_session_proxy.rb:21:in `config': Sunspot::SessionProxy::ShardingSessionProxy does not support :config (Sunspot::SessionProxy::NotSupportedError) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
open /Applications/Logic\ Pro.app/Contents/MacOS/Logic\ Pro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select 'Pennsylvania', from: 'shipping_address[region]' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddItemToCartCommand | |
include Command | |
validate :sku, presence: true | |
validate :quantity, presence: true, numericality: { greater_than_or_equal_to: 1 } | |
def cart | |
Cart.from_session(params[:session_id]) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = bcrouse | |
email = [email protected] | |
[core] | |
[color] | |
ui = true | |
[merge] | |
tool = opendiff | |
[core] | |
editor = /usr/bin/vim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = { id: 'id', name: 'something' } | |
index = Tire::Index.new('index_name') | |
index.store(data) | |
index.refresh #(optionally) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"ActionController::RoutingError"=>:not_found, | |
"AbstractController::ActionNotFound"=>:not_found, | |
"ActionController::MethodNotAllowed"=>:method_not_allowed, | |
"ActionController::NotImplemented"=>:not_implemented, | |
"ActionController::InvalidAuthenticityToken"=>:unprocessable_entity, | |
"ActiveRecord::RecordNotFound"=>:not_found, | |
"ActiveRecord::StaleObjectError"=>:conflict, | |
"ActiveRecord::RecordInvalid"=>:unprocessable_entity, | |
"ActiveRecord::RecordNotSaved"=>:unprocessable_entity | |
} |
OlderNewer