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
# Package Maintainer: Increment phusion_release to match latest release available | |
%define phusion_release 20090928 | |
Summary: Ruby Enterprise Edition (Release %{phusion_release}) | |
Name: ruby-enterprise | |
Vendor: Phusion.nl | |
Packager: Adam Vollrath <[email protected]> | |
Version: 1.8.7 | |
Release: 1%{dist} | |
License: GPL |
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
# git cheat sheet. Pretty much all you need. Corrections to @troyd, credit to @lindvall | |
# settings | |
git config --global branch.autosetupmerge true | |
git config --global push.default current | |
# create new branch locally | |
git checkout -b prove-brooks-law-42 | |
# then on remote server | |
# (requires http://git-wt-commit.rubyforge.org/git-publish-branch in path) |
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
RAILS_ENV=production ruby -r/tmp/require_tracking.rb -e "require 'config/environment'" | |
Memory used by file: | |
File KB | |
------------- -------- | |
config/environment: 209,623 | |
/srv/myapp/releases/20091230003757/app/models/user: 73,653 | |
/srv/myapp/releases/20091230003757/app/models/store: 70,962 | |
./config/boot: 15,021 | |
/srv/myapp/releases/20091230003757/app/models/discount_code: 9,813 | |
/srv/myapp/releases/20091230003757/app/models/order: 9,390 |
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 JsonHax | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if env['CONTENT_TYPE'] == 'application/json' | |
env['CONTENT_TYPE'] = 'application/xml' | |
env['REQUEST_URI'].gsub!(/\.json/, '.xml') |
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
# Requires Cramp 0.8+ | |
require 'rubygems' | |
require 'usher' | |
require 'cramp/controller' | |
Cramp::Controller::Websocket.backend = :thin | |
class WebsockAction < Cramp::Controller::Websocket | |
periodic_timer :send_hello_world, :every => 2 | |
on_data :received_data |
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
[alias] | |
up = !sh -c 'git pull && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..' |
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
# Apache2 Status by Hampton Catlin | |
# | |
# Free Use Under the MIT License | |
# | |
# Please note, your server must respond to "apache2ctl status" | |
# | |
class Apache2Status < Scout::Plugin | |
OPTIONS=<<-EOS | |
sample_size: |
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 'webrick' | |
require 'webrick/httpproxy' | |
require 'fileutils' | |
require 'md5' | |
### | |
# FakeWebRecorder is an HTTP Proxy that records sessions as calls to FakeWeb. | |
# The code that FakeWebRecorder generates should be suitable for testing | |
# interaction with a particular website. | |
# |
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
# estimate the duration of an ALTER TABLE statement in mysql | |
# this code estimates the worst case, as most of the time, an ALTER will result in a table that is smaller than the original | |
percentage = 0 | |
interval = 10 | |
while(true) do | |
begin | |
sleep(interval) | |
new_percentage = (File.size('#sql-137f_5dee5a6.ibd')*1.0 / File.size('users.ibd')*1.0) | |
change = new_percentage - percentage |
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 :cowboy do | |
desc 'Deploy without SCM' | |
task :default do | |
deploy_stage = fetch(:stage, 'none') | |
set :repository, "." | |
set :deploy_via, :copy | |
set :scm, :none | |
set :stage, deploy_stage | |
set :cowboy_deploy, true | |
set :copy_exclude, [".git/*", ".svn/*", "log/*", "vendor/bundle/*"] |