Skip to content

Instantly share code, notes, and snippets.

View masterkain's full-sized avatar
🤖

Kain masterkain

🤖
View GitHub Profile
From 4df22d595120e6eef596ebf10e36458b2a88e958 Mon Sep 17 00:00:00 2001
From: Rob Anderton <rob.anderton@thewebfellas.com>
Date: Tue, 30 Mar 2010 16:44:52 +0100
Subject: [PATCH 1/3] fix problems with newer versions of test/unit
---
test/helper.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/helper.rb b/test/helper.rb
module ActiveRecord::ConnectionAdapters
class MysqlAdapter
alias_method :execute_without_retry, :execute
def execute(*args)
execute_without_retry(*args)
rescue ActiveRecord::StatementInvalid => e
if e.message =~ /server has gone away/i
warn "Server timed out, retrying"
reconnect!
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
class Object
def this_method
caller[0]=~/`(.*?)'/
$1
end
end
# Rename an email address in all old commits.
# WARNING: Will change all your commit SHA1s.
# Based off of the script from here:
# http://coffee.geek.nz/how-change-author-git.html
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "joern.zaefferer@googlemail.com" ];
then
GIT_AUTHOR_EMAIL="joern.zaefferer@gmail.com";
GIT_COMMITTER_EMAIL="joern.zaefferer@gmail.com";
git commit-tree "$@";
diff --git a/Rakefile b/Rakefile
index 3bb0e85..d3133a3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -8,3 +8,9 @@ require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
+
+# temporary work around for
def browse
root, dir = File.expand_path("."), request[:dir]
@lis = []
begin
path = root + "/" + dir
Dir.chdir(File.expand_path(path)) do
if Dir.pwd[0,root.length] == root then
files = Dir.glob("*")
files.each{ |x|
next unless File.directory?(x)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true />
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/usr/local/mysql/bin/mysqld_safe</string>
has_many :documents, :through => :contributions, :select => "documents.*, join_table.rich_attribute" do
def push_with_attributes(document, rich_join_attrs)
Contribution.send(:with_scope, :create => rich_join_attrs) { self << document }
end
end
def self.available_languages_codes
codes = []
available_languages_columns.each do |column|
codes << column.to_s.gsub(/content_/, '')
end
codes
end