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 | |
| # | |
| # Download and install libevent and memcached from source on Debian Etch or | |
| # Debian Lenny. | |
| # | |
| # Assumptions | |
| # - libevent and memcached have not been installed from apt repositories | |
| # - memcached is not already running | |
| # - it is ok to clobber scripts at | |
| # /etc/memcached.conf |
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 your workers are inactive for a long period of time, they'll lose | |
| # their MySQL connection. | |
| # | |
| # This hack ensures we re-connect whenever a connection is | |
| # lost. Because, really. why not? | |
| # | |
| # Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
| # | |
| # From: | |
| # http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
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 'rubygems' | |
| require 'sinatra' | |
| require 'redis' | |
| # To use, simply start your Redis server and boot this | |
| # example app with: | |
| # ruby example_note_keeping_app.rb | |
| # | |
| # Point your browser to http://localhost:4567 and enjoy! | |
| # |
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
| # Application Generator Template | |
| # Modifies a Rails app to use Mongoid, Devise, jQuery, Haml | |
| # Usage: rails new app_name -m http://gist.github.com/raw/555181/gistfile1.txt | |
| # More info: http://github.com/fortuity/rails3-mongoid-devise/ | |
| # If you are customizing this template, you can use any methods provided by Thor::Actions | |
| # http://rdoc.info/rdoc/wycats/thor/blob/f939a3e8a854616784cac1dcff04ef4f3ee5f7ff/Thor/Actions.html | |
| # and Rails::Generators::Actions | |
| # http://github.com/rails/rails/blob/master/railties/lib/rails/generators/actions.rb |
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 FanCount | |
| @queue = "FanCount" | |
| include Mongoid::Document | |
| field :page_id | |
| field :fans | |
| field :date, :type => DateTime | |
| index :page_id, :unique => true, :background => true | |
| index( |
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 | |
| # | |
| # PROVIDE: cccms | |
| # REQUIRE: nginx cleanvar | |
| . /etc/rc.subr | |
| name=cccms | |
| rcvar=`set_rcvar` |
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
| # unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| # 16 workers and 1 master | |
| worker_processes (rails_env == 'production' ? 16 : 4) | |
| # Load rails+github.git into the master before forking workers | |
| # for super-fast worker spawn times | |
| preload_app true |
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 'test/unit' | |
| require 'rubygems' | |
| require 'shoulda' | |
| require 'factory_girl' | |
| require 'dm-core' | |
| require 'dm-validations' # Needed for save! | |
| class User | |
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 | |
| set -u | |
| set -e | |
| # Example init script, this can be used with nginx, too, | |
| # since nginx and unicorn accept the same signals | |
| # Feel free to change any of the following variables for your app: | |
| APPNAME=<%=fetch(:unicorn_app_name)%> | |
| RUNAS=<%=fetch(:unicorn_run_as)%> |
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
| # Sample unicorn config file | |
| # unicorn -c config/unicorn.rb -E development | |
| # unicorn -c config/unicorn.rb -E <environment> -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| # 16 workers and 1 master | |
| worker_processes (rails_env == 'production' ? 16 : 2) | |
| # Load rails+github.git into the master before forking workers |