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
# in config/application.rb | |
# ... snip (bunch of requires) ... | |
module MyApp | |
class Application < Rails::Application | |
# ... snip (config)... | |
# Make sure deface ignores precompiled views in development | |
initializer "deface.precompile.remove_inject_views", :before => :add_view_paths do |app| |
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
# | |
# Decorate Spree::LineItem model to add keg deposits | |
# and CRV automatically to the order (derived from | |
# the package format fees) when line items are changed | |
# | |
Spree::LineItem.class_eval do | |
after_save :update_order_package_fees | |
def update_order_package_fees |
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 loop { | |
echo -e "\nWaiting for changes..." | |
while inotifywait -qr -e close_write . | |
do | |
clear && $@ && echo -e "\nWaiting for changes..." | |
done | |
} |
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 rebuild { | |
while inotifywait -qr -e close_write $2; do clear && $1 $2; done | |
} |
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
def collect_with_number(number, key, &block) | |
opts = {} | |
opts[key] = MAX_NUM_RESULTS | |
statuses = collect_with_max_id do |max_id| | |
opts[:max_id] = max_id unless max_id.nil? | |
opts[key] = number unless number >= MAX_NUM_RESULTS | |
if number > 0 | |
# Instead of this: | |
# number -= MAX_NUM_RESULTS | |
statuses = retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do |
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
# app/views/layouts/application.html.erb | |
<% head_style 'styles' %> | |
<% head_javascript 'application' %> | |
<%= render :file => 'layouts/rails_admin/main' %> |
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
// Does it already exists? | |
if (MyApp.MyModel.storeKeyExists('foobar')) { | |
// The key exists, so retrieve the record to update it | |
var record = MyApp.store.find(MyApp.MyModel, 'foobar'); | |
// We only need to update the sources | |
record.set('something', 'yeah'); | |
} else { |
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
// ========================================================================== | |
// Project: SproutSrchr.SourceCheckboxes | |
// Copyright: ©2011 My Company, Inc. | |
// ========================================================================== | |
/*globals SproutSrchr */ | |
/** @class | |
This is the source picker: it's a view with a row of checkboxes (1 for each source) |
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
features/projects/creating.feature | |
features/projects/deleting.feature | |
features/projects/editing.feature | |
features/projects/viewing.feature | |
features/tickets/creating.feature | |
features/tickets/deleting.feature | |
features/tickets/editing.feature | |
features/tickets/viewing.feature | |
features/tickets/notifications.feature |
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
$ rvm use ruby-1.9.2 | |
Using /usr/local/rvm/gems/ruby-1.9.2-p136 | |
$ time cucumber | |
... | |
real 0m19.146s | |
user 0m9.857s |
NewerOlder