Skip to content

Instantly share code, notes, and snippets.

Peter Moran pmoran

Block or report user

Report or block pmoran

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pmoran / gist:3011108
Created Jun 28, 2012
Clear property searches from cache
View gist:3011108
redis-cli -n 1 KEYS "cache:property:offers*" | xargs redis-cli -n 1 DEL
pmoran / newco-commit-msg
Created Nov 3, 2011
Git hook to make sure commit message contains stream identifier
View newco-commit-msg
#!/usr/bin/env ruby
message_file = ARGV[0]
message =
$regex = /^\[(Extranet|API|Consumer)\]/
if !$regex.match(message)
puts "COMMIT FAILED: your message doesn't start with [Extranet], [API] or [Consumer]"
exit 1
View gist:787825
"filters": {
"pending": "function(doc, req) { if(doc.status != 'forwarded') { return true; } else { return false; }}"
View gist:787765
"unprocessed" : {
"map" : "function(doc){ if(!doc.status) { emit(doc.requested_at, doc.text) } }"
View gist:787763
def handle_notification(notification)
message = JSON.parse(notification)['doc'] {
result = despatch(message) # non-blocking
@db.save_doc(message.merge(status: "forwarded", result: result)) # blocking
def despatch(message)
http = http_request({id: message['_id'], broadcast: message['text']})
View gist:787759
def run {
opts = { query: {feed: 'continuous', since: update_seq, heartbeat: 5000, filter: 'app/pending', include_docs: true} }
http ="#{DB_URL}/_changes").get opts { |chunk| handle_notification(chunk) unless chunk =~ /^\n/ }
View gist:787753
"_id": "2c698404172067bf64c5be5daf5b4c4a",
"_rev": "1-5d0c994e3f4626e9e944977cc121b9d4",
"text": "first message",
"requested_at": "2011/01/17 09:54:17 +0000",
"priority": "medium"
View gist:787751
db.save_doc({text: "first message", requested_at:, priority: "medium"})
View gist:739583
# Ripped from cucumber-0.8.3/examples/watir/features/support/screenshots.rb
module Screenshots
if Cucumber::OS_X
def embed_screenshot(id)
`screencapture -t png reports/#{id}.png`
embed("#{id}.png", "image/png")
def embed_screenshot(id)
`import -window root reports/#{id}.png`
You can’t perform that action at this time.