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 AsyncSupport | |
def eventually(timeout = 10) | |
polling_interval = 0.1 | |
time_limit = Time.now + timeout | |
loop do | |
begin | |
yield | |
rescue Exception => error | |
end | |
return if error.nil? |
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
DROP TABLE IF EXISTS time_dimension; | |
CREATE TABLE time_dimension ( | |
id INTEGER PRIMARY KEY, -- year*10000+month*100+day | |
db_date DATE NOT NULL, | |
year INTEGER NOT NULL, | |
month INTEGER NOT NULL, -- 1 to 12 | |
day INTEGER NOT NULL, -- 1 to 31 | |
quarter INTEGER NOT NULL, -- 1 to 4 | |
week INTEGER NOT NULL, -- 1 to 52/53 | |
day_name VARCHAR(9) NOT NULL, -- 'Monday', 'Tuesday'... |
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
pid = Process.pid | |
rss = `ps -eo pid,rss | grep #{pid} | awk '{print $2}'`.to_i | |
puts "MEMORY[#{pid}]: rss: #{rss}, live objects #{GC.stat[:heap_live_slots]}" |
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
def merge(id, message) | |
main_p = Problem.find(id) | |
Problem.where(message: /^#{message}/).each {|p| ProblemMerge.new(main_p, p).merge unless p == main_p} | |
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
org.jruby.rack.RackInitializationException: undefined method `raw_date_time?' for ActiveRecord::ConnectionAdapters::JdbcConnection:Class | |
from /usr/share/apache-tomcat-7.0.34/webapps/ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.6/lib/arjdbc/jdbc/adapter.rb:862:in `JdbcAdapter' | |
from /usr/share/apache-tomcat-7.0.34/webapps/ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.6/lib/arjdbc/jdbc/adapter.rb:35:in `ConnectionAdapters' | |
from /usr/share/apache-tomcat-7.0.34/webapps/ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.6/lib/arjdbc/jdbc/adapter.rb:17:in `ActiveRecord' | |
from /usr/share/apache-tomcat-7.0.34/webapps/ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.6/lib/arjdbc/jdbc/adapter.rb:16:in `(root)' | |
from org/jruby/RubyKernel.java:1027:in `require' | |
from /usr/share/apache-tomcat-7.0.34/webapps/ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.6/lib/arjdbc/jdbc.rb:1:in `(root)' | |
from org/jruby/RubyKernel.java:1027:in `require' | |
from /usr/share/apache-tomcat-7.0.34/webapps/ROOT/WEB-IN |
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
Given /^I send and accept JSON$/ do | |
header 'Accept', 'application/json' | |
header 'Content-Type', 'application/json' | |
end | |
Given /the following API Keys exist/ do | keys | | |
keys.hashes.each do | k | | |
ApiKey.create! k | |
end | |
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
git submodule add git://github.com/defunkt/my-fantastic-plugin.git plugins/my-fantastic-plugin |