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
| namespace :cache do | |
| namespace :fragment do | |
| desc 'Manually remove all fragment caches' | |
| task :delete => :environment do | |
| ActionController::Base.cache_store.clear | |
| end | |
| end | |
| 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
| #!/usr/bin/env ruby | |
| # Sets up remote tracking if you forgot to --track a branch, | |
| # or if you're setting up a new branch. | |
| # Save in ~/bin/ or somewhere else on your path. | |
| # Usage: | |
| # git track [[remote] branch] | |
| # remote defaults to 'origin' | |
| # branch defaults to the name of the current local branch |
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
| if request.accept.include?('application/json') | |
| content_type :json | |
| else | |
| content_type :text | |
| 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
| # MongoMapper "embedded document delete" plugin | |
| # By Peter Cooper | |
| # | |
| # Got embedded documents you want to delete? You can delete them as if the | |
| # embedded document collection were an array, but then there's no way to get | |
| # a callback (as far as I could tell). This plugin gives you a call back | |
| # (if you want it) and gives a nicer syntax to deleting embedded docs. | |
| # | |
| # Example: | |
| # |
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 Foo | |
| plugin MongoMapper::Plugins::IdentityMap | |
| end | |
| Or you can add to all documents like this: | |
| module IdentityMapAddition | |
| def self.included(model) | |
| model.plugin MongoMapper::Plugins::IdentityMap | |
| 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
| .DS_Store | |
| *.csv | |
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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'fastercsv' | |
| require 'roo' | |
| if ARGV.size >= 1 | |
| file = ARGV.first | |
| if file && File.exists?(file) && File.extname(file) == '.xlsx' |
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
| require "resque" | |
| require "resque/failure/multiple" | |
| require "resque/failure/redis" | |
| # Configure Resque connection from config/redis.yml. This file should look | |
| # something like: | |
| # development: localhost:6379 | |
| # test: localhost:6379:15 | |
| # production: localhost:6379 | |
| Resque.redis = YAML.load_file(Rails.root + 'config/redis.yml')[Rails.env] |
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/sh | |
| ### BEGIN INIT INFO | |
| # Provides: mongodb | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: starts the mongodb data-store | |
| # Description: starts mongodb using start-stop-daemon |
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 NoWWW | |
| STARTS_WITH_WWW = /^www\./i | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| if env['HTTP_HOST'] =~ STARTS_WITH_WWW |