most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
def forked! | |
ActiveRecord::Base.connection.reconnect! | |
Rails.cache.instance_variable_get(:@data).reset | |
Mongoid.config.master.connection.close | |
load File.join(RAILS_ROOT, 'config/initializers/mongoid.rb') | |
end | |
def run(job) | |
runtime = Benchmark.realtime do | |
fork do |
Blog post here
# | |
# Ideas stolen from lograge and brought to Rails 2.3 | |
# https://github.com/mattmatt/lograge/blob/master/lib/lograge/log_subscriber.rb | |
# | |
module ImprovedControllerLogging | |
def self.included(base) | |
base.alias_method_chain :log_processing, :fixup | |
base.inject_alias_method_chain :perform_action, | |
:perform_action_with_benchmark, |
require 'action_mailer' | |
require 'mail' | |
module ActionMailer | |
class Base | |
def clean_address(str) | |
EmailAddress.parse(str, :no_default_name => true).quoted rescue str | |
end | |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
Changes:
this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .
ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.
this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.
This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.
# Accurate queue times for Heroku Cedar + Rails (or Rack) | |
# | |
# For Rails: | |
# | |
# Rails::Application.middleware.insert(0, QueueTimeLogger) | |
# | |
class QueueTimeLogger | |
attr_reader :app | |
def initialize(app, options = {}) |
if Rails.version < '3.0' | |
require 'mail' | |
require 'active_support/core_ext/module/attr_internal' | |
class ActionMailer3 | |
class Collector | |
attr_reader :responses | |
def initialize(context, &block) | |
@context = context |
def log(data) | |
result = nil | |
if data.key?(:measure) | |
name = data.delete(:measure).insert(0, ENV["APP_NAME"] + ".") | |
end | |
if block_given? | |
start = Time.now | |
result = yield | |
elapsed = (Time.now.to_f - start.to_f) * 1000 | |
data.merge!("measure.#{name}" => elapsed.round) |