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
today = Date.today.strftime("%Y-%m-%d") | |
yesterday = (Date.today - 1).strftime("%Y-%m-%d") | |
cmd = "svn log -r {#{yesterday}}:{#{today}}" | |
puts cmd | |
raise "Error!" unless system(cmd) | |
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
Index: thinking-sphinx/tasks/thinking_sphinx_tasks.rb | |
=================================================================== | |
--- thinking-sphinx/tasks/thinking_sphinx_tasks.rb (revision 809) | |
+++ thinking-sphinx/tasks/thinking_sphinx_tasks.rb (revision 881) | |
@@ -59,12 +59,12 @@ | |
puts "Generating Configuration to #{config.config_file}" | |
config.build | |
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
preprocess { | |
Item.delete_all | |
} | |
source(:csv_file) { | |
FasterCSV.open(get_var(:source_file),"rb", :col_sep => ';', :headers => true) | |
} | |
each_row { |row| | |
Item.create!(row[:data].to_hash) # if (@counter = (@counter || 0) + 1) < 200 |
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
preprocess { | |
# mark the current data for deletion - do not delete right away | |
# to avoid ending up with no data on the web-site | |
Item.update_all('marked_for_deletion = 1') | |
} | |
source(:csv_file) { | |
FasterCSV.open(get_var(:source_file),"rb", :col_sep => ';', :headers => true) | |
} | |
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
When calling rake ts:index or rake ts:start, if the command is not successful, you'll get something like: | |
======================================= | |
The following command failed! | |
indexer --config /Users/login/Work/my_app/trunk/my_app/config/development.sphinx.conf --all | |
This may be caused by a PATH issue in your environment (cron/passenger/... ?). Here is the current PATH: | |
/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin |
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
<VirtualHost <%= public_ip %>:80> | |
ServerName <%= server_name %> | |
# server aliases (generated from config) | |
<% ((server_aliases.keys + server_aliases.values).flatten - [server_name]).each do |server_alias| %> | |
ServerAlias <%= server_alias %><% end %> | |
DocumentRoot <%= public_path %> | |
<Directory "<%= public_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
/* the helper, built as a Control extension method */ | |
public delegate void Action(); | |
public static void InUIThread(this Control control, Action action) { | |
if (control.InvokeRequired) | |
control.EndInvoke(control.BeginInvoke(action)); | |
else | |
action(); | |
} |
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
public static void InWorkerThread(this Control control, Action action) { | |
BackgroundWorker worker = new BackgroundWorker(); | |
worker.DoWork += (sender, e) => action(); | |
worker.RunWorkerAsync(); | |
while (worker.IsBusy) | |
System.Windows.Forms.Application.DoEvents(); | |
} |
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 Ramaze | |
module Helper | |
module WillPaginateForRamaze | |
include ActionView::Helpers::UrlHelper | |
include ActionView::Helpers::TagHelper | |
include WillPaginate::ViewHelpers | |
def url_for(args) | |
url = case args | |
when Hash; |
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
# patch to handle connection pooling outside of rails: http://www.williambharding.com/blog/rants/rails-22-connection-pools-mongrel-handlers-bloodbath/ | |
# call ActiveRecord::Base.connection_handler.clear_connection! from your controller once you're done with ActiveRecord work | |
module ActiveRecord | |
module ConnectionAdapters | |
class ConnectionPool | |
def release_connection(conn_id = nil) | |
conn_id ||= current_connection_id | |
conn = @reserved_connections.delete(conn_id) | |
checkin conn if conn | |
end |