This file contains 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
echo 'events { | |
worker_connections 1024; | |
} | |
error_log /usr/local/Cellar/nginx/1.5.8/error.log; | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; |
This file contains 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
# standard capistrano config goes here.... | |
# Put the maintenance screen if DB migrations take in place only | |
before "deploy", "deploy:delayed_job:stop" | |
before "deploy:migrations", "deploy:delayed_job:stop" | |
after "deploy:update_code", "deploy:symlink_shared", "deploy:assets_compress" | |
before "deploy:migrate", "deploy:web:disable", "deploy:db:backup" | |
after "deploy", "newrelic:notice_deployment", "deploy:cleanup", "deploy:delayed_job:restart" |
This file contains 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
# This the bash script to handle up-and-runnig VM created through Vagrant | |
#!/usr/bin/env bash | |
# PRIVATE: error level message | |
error_message () { | |
echo "$(tput setaf 1)ERROR: $1$(tput sgr0)" | |
} | |
This file contains 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 -e | |
RUBY_VERSION=2.0.0 | |
if [ "$RUBY_VERSION" == '2.0.0' ]; then | |
yum -y install ruby20 rubygems20 ruby-devel | |
alternatives --set ruby /usr/bin/ruby2.0 | |
elif [ "$RUBY_VERSION" == '1.9.3' ]; then | |
yum -y install ruby19 rubygems19 ruby19-devel |
This file contains 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 ActionDispatch | |
class Reloader | |
def call(env) | |
if env['PATH_INFO'].include?(Rails.application.config.assets.prefix) | |
@app.call(env) | |
else | |
@validated = @condition.call | |
prepare! |
This file contains 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
net.inet.tcp.sack=1 | |
net.inet.tcp.rfc1323=1 | |
net.inet.tcp.recvspace=1048576 | |
net.inet.udp.recvspace=1048576 | |
net.inet.tcp.sendspace=1048576 | |
net.inet.tcp.mssdflt=1460 | |
net.inet.tcp.win_scale_factor=8 |
This file contains 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 Object | |
class UnitTestError < StandardError; end | |
def describe(description, &block) | |
if Object.class_eval(&block) | |
print '.' | |
else | |
puts 'FAIL ' + description | |
raise UnitTestError |
This file contains 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 | |
ip route |grep default # default via 10.235.9.1 dev eth0 | |
ip route change default via `ip route| awk '/^def/{print $3}'` dev eth0 initcwnd 16 | |
ip route |grep default # default via 10.235.9.1 dev eth0 initcwnd 16 | |
sysctl -w net.ipv4.tcp_slow_start_after_idle=0 | |
sysctl -a |grep net.ipv4.tcp_slow_start_after_idle |
This file contains 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 ActiveRecord::ConnectionAdapters::Mysql2Adapter | |
private | |
alias_method :configure_connection_without_strict_mode, :configure_connection | |
def configure_connection | |
configure_connection_without_strict_mode | |
strict_mode = "SQL_MODE='STRICT_ALL_TABLES'" | |
execute("SET #{strict_mode}", :skip_logging) | |
end |
This file contains 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 ReverseSentence | |
def initialize(string) | |
@array, @array_reversed = string.split(" "), [] | |
end | |
def process | |
@array_reversed << @array.pop while @array.any? | |
@array_reversed.join(" ") | |
end |