Skip to content

Instantly share code, notes, and snippets.

View kidpollo's full-sized avatar
💁‍♂️
Potato farming

Paco Viramontes kidpollo

💁‍♂️
Potato farming
  • San Francisco, CA
View GitHub Profile
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 {
#!/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] %>
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")
# 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
upstream example {
server unix:/data/example/shared/tmp/pids/example.sock;
}
server {
listen 80;
server_name *.example.com;
root /data/example/current/public;
if ($host ~* ^([^.]+\.[^.]+)$) {
set $host_without_subdomain $1;
rewrite ^\/(\w+)(\/.*)$ http://$1.$host_without_subdomain$2 break;
}
# 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)
########### 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'
require 'rest_client'
require 'json'
###################
# CONF #
###################
# The smallest amount of changed documents before the views are updated
MIN_NUM_OF_CHANGED_DOCS = 10
def current_account_controller_access
@current_account_controller_access ||= Hash[*current_account.features.collect{|feature| [feature.controller_name, feature.actions] }.flatten]
end