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 ($host ~* ^([^.]+\.[^.]+)$) { | |
set $host_without_subdomain $1; | |
rewrite ^\/(\w+)(\/.*)$ http://$1.$host_without_subdomain$2 break; | |
} | |
upstream empowerkit { | |
server unix:/data/example/shared/tmp/pids/example.sock; | |
} | |
server { |
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: | |
APP_ROOT=<%= @app_dir %>/current | |
PID=<%= @app_dir %>/shared/tmp/pids/<%= @app_name %>.pid | |
ENV=<%= @node[:environment][:framework_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
working_directory '<%= @app_dir %>/current/' | |
worker_processes <%= @workers %> | |
listen '<%= @app_dir %>/shared/tmp/pids/<%= @app_name %>.sock', :backlog => 1024 | |
timeout 60 | |
pid "<%= @app_dir %>/shared/tmp/pids/<%= @app_name %>.pid" | |
# Based on http://gist.github.com/206253 | |
logger Logger.new("log/unicorn.log") |
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
# full reinstall mysql server | |
apt-get remove --purge 'mysql-server.*' | |
rm -rf /etc/mysql | |
rm -rf /var/run/mysqld | |
rm -rf /db/mysql | |
rm -rf /db/mysql | |
rm -rf /var/lib/mysql | |
apt-get install mysql-server |
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 example { | |
server unix:/data/example/shared/tmp/pids/example.sock; | |
} | |
server { | |
listen 80; | |
server_name *.example.com; | |
root /data/example/current/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
if ($host ~* ^([^.]+\.[^.]+)$) { | |
set $host_without_subdomain $1; | |
rewrite ^\/(\w+)(\/.*)$ http://$1.$host_without_subdomain$2 break; | |
} |
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
# usage: | |
# field_labeled('Select your address').should have_option("Home Address") | |
Spec::Matchers.define :have_option do |expected| | |
def options_for(select_field) | |
select_field.options.map(&:inner_text) | |
end | |
match do |select_field| | |
raise "Field is not a SelectField" unless select_field.kind_of?(Webrat::SelectField) | |
options_for(select_field).include?(expected) |
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
########### pio.la | |
# => Ver Configuracion | |
# cat /usr/local/mongodb/mongod.conf | |
# => Iniciar mongo | |
# sudo mongod --config /usr/local/mongodb/mongod.conf | |
require "mongomapper" | |
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017) | |
MongoMapper.database = 'piola' |
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 'rest_client' | |
require 'json' | |
################### | |
# CONF # | |
################### | |
# The smallest amount of changed documents before the views are updated | |
MIN_NUM_OF_CHANGED_DOCS = 10 |
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 current_account_controller_access | |
@current_account_controller_access ||= Hash[*current_account.features.collect{|feature| [feature.controller_name, feature.actions] }.flatten] | |
end |