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
| upstream backend { | |
| server 127.0.0.1:3000 fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| server_name mydomain.com; | |
| root /path/to/project/public; |
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
| timer_resolution 100ms; | |
| worker_priority -5; | |
| events { | |
| use epoll; | |
| worker_connections 2048; | |
| } | |
| server { | |
| ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; |
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 UrlProxy | |
| def initialize(url) | |
| @uri = URI.parse(url) | |
| end | |
| def path | |
| @uri.request_uri | |
| end | |
| def method_missing(m, *args) |
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
| # Rails on-screen logging | |
| def change_log(stream) | |
| ActiveRecord::Base.logger = Logger.new(stream) | |
| ActiveRecord::Base.clear_active_connections! | |
| end | |
| def show_log | |
| change_log(STDOUT) | |
| reload! |
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: redis-server | |
| # Required-Start: $syslog | |
| # Required-Stop: $syslog | |
| # Should-Start: $local_fs | |
| # Should-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: redis-server - Persistent key-value db |
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
| httperf_report do |r| | |
| r.cookies :signed_request => 'asdasd' | |
| r.group 'Mission List' do |g| | |
| 1000.times do | |
| g.get '/mission_groups' | |
| end | |
| end | |
| r.group 'Mission Group Switch' do |g| |
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 app_client | |
| puts 'Obtaining app authentication...' | |
| @app_client ||= Mogli::AppClient.create_and_authenticate_as_application(Facebooker2.app_id, Facebooker2.secret).tap do | |
| puts 'Done!' | |
| end | |
| end | |
| def test_user(options = {}) | |
| puts 'Creating test 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
| ActiveRecord::Base.class_eval do | |
| before_save :set_site | |
| def set_site | |
| self.site_id = $current_site[:id] if respond_to?(:site_id=) | |
| 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
| user app; | |
| worker_processes 2; | |
| error_log /home/app/logs/nginx.error.log info; | |
| events { | |
| worker_connections 1024; | |
| } | |
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
| module AuthHelper | |
| def if_admin | |
| if user = current_user && user.active? && user.roles.include?(:admin) | |
| yield | |
| end | |
| end | |
| end |