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 Boolean | |
end | |
class TrueClass | |
include Boolean | |
end | |
class FalseClass | |
include Boolean | |
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
# cd into a matching gem directory. Pass a grep compatible | |
# regular expression. If you don't pass anything, it goes | |
# to the root gem directory. | |
cdgem () | |
{ | |
local gempath=$(gem env gemdir)/gems; | |
if [[ $1 == "" ]]; then | |
pushd $gempath; | |
return; | |
fi; |
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
LOOKUP_CHAIN = [:params, :user, :session, :http, :default] | |
# hairy and cryptic | |
def self.set_by | |
lookup = LOOKUP_CHAIN.each | |
begin | |
meth = lookup.next | |
end while !(locale = send("by_#{meth}", meth) rescue nil); | |
locale | |
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
~/projects/jruby ➔ jmap -histo 19907 | grep rubyobj | head -50 | |
116: 1945 46680 rubyobj.Gem.Version | |
118: 1898 45552 rubyobj.Gem.Version | |
120: 1826 43824 rubyobj.Gem.Requirement | |
123: 1804 43296 rubyobj.Gem.Requirement | |
158: 914 21936 rubyobj.Gem.Dependency | |
166: 876 21024 rubyobj.Gem.Dependency | |
209: 463 11112 rubyobj.Gem.Specification | |
211: 455 10920 rubyobj.Gem.Specification | |
319: 142 3408 rubyobj.ActiveSupport.TimeZone |
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
# | |
# Created by Eric Lindvall <[email protected]> | |
# | |
# WHAT: Provides a simple overview of memory allocation occuring during a | |
# require. | |
# | |
# For a longer explanation, see my post at: | |
# | |
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby | |
# |
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 'benchmark' | |
module Kernel | |
alias old_require require | |
def require(path) | |
#unless caller.find { |caller_line| caller_line.match /dependencies\.rb/ } | |
# return old_require(path) | |
#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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
# Used to graph results from autobench | |
# | |
# Usage: ruby autobench_grapher.rb result_from_autobench.tsv | |
# | |
# This will generate three svg & png graphs | |
require "rubygems" | |
require "scruffy" | |
require 'csv' | |
require 'yaml' |
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
#!/usr/bin/env ruby | |
# | |
# Find bloating passengers and kill them gracefully. Run from cron every minute. | |
# | |
# required for passenger since cron has no environment | |
ENV['HTTPD'] = 'httpd' | |
MEM_LIMIT = ARGV[0] || 500 | |
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 bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001 | |
From: Ilya Grigorik <[email protected]> | |
Date: Thu, 10 Jun 2010 00:46:48 -0400 | |
Subject: [PATCH] async rails3 | |
--- | |
Gemfile | 6 ++++++ | |
app/controllers/widgets_controller.rb | 6 ++++++ | |
app/models/widget.rb | 2 ++ | |
config.ru | 1 + |
NewerOlder