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 ExtendResponseTimeLogging | |
def self.included(base) | |
base.class_eval do | |
alias_method_chain :perform_action, :extra_benchmark | |
end | |
end | |
def bench(name, &block) | |
@additional_response_times[name] ||= 0.0 | |
@additional_response_times[name] += Benchmark.ms {yield} |
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
# Find out what table engine your tables are using | |
select table_name, engine from information_schema.TABLES WHERE TABLE_SCHEMA = 'DATABASENAME'; | |
# From bash, set the engine on all tables in a database to InnoDB | |
# Where /etc/mysql/debian.cnf has the root password for your mysql box | |
# Taken from http://kevin.vanzonneveld.net/techblog/article/convert_all_tables_to_innodb_in_one_go/ | |
DATABASENAME="test" | |
for t in `echo "show tables" | mysql --defaults-file=/etc/mysql/debian.cnf --batch --skip-column-names $DATABASENAME`; do mysql --defaults-file=/etc/mysql/debian.cnf $DATABASENAME -e "ALTER TABLE $t ENGINE = InnoDB;"; done |
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
glibc 2.14 breaks the install process for ruby 1.8.7 and ree 1.8.7. | |
Fix for ruby 1.8.7 install with rvm: | |
1. Run `rvm install ruby-1.8.7-p334` | |
2. Wait for it to fail. | |
3. Fix the broken files with: | |
cd ~/.rvm/src/ree-1.8.7-2011.03/source/ext/dl | |
rm callback.func | |
touch callback.func | |
ruby mkcallback.rb >> callback.func |
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
diff -urB a/distro/google-perftools-1.7/src/tcmalloc.cc b/distro/google-perftools-1.7/src/tcmalloc.cc | |
--- a/distro/google-perftools-1.7/src/tcmalloc.cc | |
+++ b/distro/google-perftools-1.7/src/tcmalloc.cc | |
@@ -137,6 +137,13 @@ | |
# define WIN32_DO_PATCHING 1 | |
#endif | |
+// GLibc 2.14+ requires the hook functions be declared volatile, based on the value of the | |
+// define __MALLOC_HOOK_VOLATILE. For compatibility with older/non-GLibc implementations, | |
+// provide an empty definition. |
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
--- frontend.conf.original 2011-07-15 09:49:50.468952712 -0700 | |
+++ frontend.conf 2011-07-15 09:55:06.948947048 -0700 | |
@@ -39,6 +39,10 @@ | |
if ($host ~* (.*)\.crystalcommerce\.com) { | |
set $client $1; | |
} | |
+ # get the client name if it matches client.crystalcommerce.com | |
+ if ($host ~* (.*)\.dev\.crystalcommerce\.com) { | |
+ set $client $1/dev; | |
+ } |
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
# Input: | |
# choices = { | |
# 'color' => %w(blue red green), | |
# 'sizes' => %w(small medium large extra-large), | |
# 'style' => %w(tshirt longsleeve) | |
# } | |
# | |
# Output: | |
# [{"sizes"=>"small", "color"=>"blue", "style"=>"tshirt"}, | |
# {"sizes"=>"small", "color"=>"blue", "style"=>"longsleeve"}, |
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
namespace :vlad do | |
namespace :assets do | |
remote_task :symlink, :roles => :app do | |
run <<-CMD | |
rm -rf #{latest_release}/public/assets && | |
mkdir -p #{latest_release}/public && | |
mkdir -p #{shared_path}/assets && | |
ln -s #{shared_path}/assets #{latest_release}/public/assets | |
CMD | |
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
# From https://svn.boost.org/trac/boost/ticket/6165 | |
# Attempting to run passenger-install-nginx-module on a system with | |
# GCC 4.7 (like archlinux) will halt with BOOST thread errors. | |
# Update the file in ~/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/ext/boost/config/stdlib/libstdcpp3.hpp | |
Index: boost/config/stdlib/libstdcpp3.hpp | |
=================================================================== | |
--- boost/config/stdlib/libstdcpp3.hpp (revision 75635) | |
+++ boost/config/stdlib/libstdcpp3.hpp (working copy) | |
@@ -33,7 +33,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
require 'base64' | |
require 'openssl' | |
require 'cgi' | |
module HmacRequestSigning | |
def inject_signature_header(headers, signature) | |
headers['X-Hmac-Sha256'] = signature | |
headers | |
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
var count = 2; | |
var loader = $('.infinite-loader'); | |
$(window).scroll(function() { | |
if($(window).scrollTop() == $(document).height() - $(window).height()) { | |
if(count > total) { | |
return false; | |
} else { |
OlderNewer