Skip to content

Instantly share code, notes, and snippets.

.#!/usr/bin/env ruby
$KCODE='UTF8'
require 'rubygems'
require 'aws/s3'
require 'main'
main do
argument('directory') {
{
"_type": "Metric",
"href": "http://data.v6.localhost/metrics/871ffeb6-6a35-4c35-a5bc-778d2cfd6456",
"name": "foo,bar,baz",
// By href
"datapoint_flavor": "numeric",
"numeric_datapoints_href": "http://data.v6.localhost/metrics/871ffeb6-6a35-4c35-a5bc-778d2cfd6456/datapoints",
"datapoints_href": "http://data.v6.localhost/metrics/871ffeb6-6a35-4c35-a5bc-778d2cfd6456/datapoints",
//
"account_href": "http://example.com/accounts/1234",
(1..143671).step(100) do |n|
puts "working on block #{n}"
Subscriber.find(:all, :conditions => ["id between ? and ?", n, n+100], :limit => 100).each do |s|
next unless s.card_number
if ['8714', '0436', '0704', '4008'].include?(s.card_number[-4,4])
puts "#{s.id} #{s.card_number}"
end
end
def expired?
# is the record's file_date over the specified number of days until expiration
if !self.identity_address.nil? && !self.identity_address.last_date_reported.blank?
last_date_reported = self.identity_address.last_date_reported.to_s
formatted_date = [ last_date_reported.slice(0,4), last_date_reported.slice(4,2), last_date_reported.slice(6,2) ].join("-")
begin
return true unless verified_date = Date.parse(formatted_date)
rescue Exception => e
raise "\"#{last_date_reported}\" is not a valid date"
end
@pezra
pezra / gist:50085
Created January 21, 2009 18:08 — forked from paul/gist:50081
@http.resource.post('/foo') do |r|
r.content_type_header = 'app/xml'
r.accept_header = 'app.xml'
r.x_custom_header = 'foo'
r.body = "<my_elem />"
end