This file contains hidden or 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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or 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
| require 'minitest/mock' | |
| require 'minitest/unit' | |
| require 'date' | |
| MiniTest::Unit.autorun | |
| class TestMailPurge < MiniTest::Unit::TestCase | |
| class MailPurge | |
| def initialize(imap) | |
| @imap = imap |
This file contains hidden or 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
| # this was surprisingly difficult to find, the documentation and API is poor | |
| require "net/http" | |
| require "uri" | |
| url = URI.parse("http://www.whatismyip.com/automation/n09230945.asp") | |
| req = Net::HTTP::Get.new(url.path) | |
| req.add_field("X-Forwarded-For", "0.0.0.0") | |
| # For content type, you could also use content_type=(type, params={}) |
This file contains hidden or 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
| # Doesn't work | |
| <p> | |
| <% case @request.author_hosted %> | |
| <% when "yes" %> | |
| The school <b>has</b> hosted an author before. | |
| <% when "no" %> | |
| The school <b>has not</b> hosted an author before. | |
| <% end %> | |
| </p> |
NewerOlder