Skip to content

Instantly share code, notes, and snippets.

View mauricioszabo's full-sized avatar

Maurício Szabo mauricioszabo

View GitHub Profile
@mauricioszabo
mauricioszabo / gist:2580938
Created May 2, 2012 22:09 — forked from isa/gist:2571012
Convert in less than 30 lines
val before = List(
List('A', 'B', 'C'),
List('A', 'C', 'E'),
List('E', 'F', 'D'),
List('D', 'A', 'J'),
List('E', 'D', 'J')
)
val expected = List(
List('A', 'B', 1),
@mauricioszabo
mauricioszabo / gist:2580923
Created May 2, 2012 22:05 — forked from isa/gist:2571012
Convert in less than 30 lines
val list = List(
('A', 'B', 'C'),
('A', 'C', 'E'),
('E', 'F', 'D'),
('D', 'A', 'J'),
('E', 'D', 'J')
)
val expected = List(
('A', 'B', 1),
...
# Restart Passenger
deploy.task :restart, :roles => :app do
...
# Restart the resque workers
run "cd #{current_path} && rake queue:restart_workers RAILS_ENV=production"
end
@mauricioszabo
mauricioszabo / connection_fix.rb
Created October 10, 2011 18:38 — forked from defunkt/connection_fix.rb
MySQL server has gone away fix
# 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/