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
#! /usr/bin/env python | |
""" Convert values between RGB hex codes and xterm-256 color codes. | |
Nice long listing of all 256 colors and their codes. Useful for | |
developing console color themes, or even script output schemes. | |
Resources: | |
* http://en.wikipedia.org/wiki/8-bit_color | |
* http://en.wikipedia.org/wiki/ANSI_escape_code |
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 'mechanize' | |
URL_FILE = "qc_urls" | |
OUTPUT_FILE = "qc_urls_out" | |
class QuantcastCrawler | |
def initialize(file_path, output_path) | |
@file_path = file_path | |
@output_path = output_path | |
end |
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
# named_scope :relative_of, lambda { |id| | |
# subject = Subject.find(id) | |
# ids = subject.child_subjects.map(&:id) | |
# ids << id | |
# { :conditions => { :subject_id => ids } } | |
# } |
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 is the current solution. It merely validates the string's inclusion in | |
# the given list, and saves it as a string. | |
ActiveRecord::Schema.define(:version => 20110101000000) do | |
create_table "foos", :force => true do |t| | |
t.string "bar" | |
end | |
end | |
class Foo < ActiveRecord::Base |
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
def makeProgress(i, t) | |
percent = (Float(i) / Float(t)) * 100 | |
percent = (( percent / 5).round * 5).to_i | |
number_of_bars = percent / 5 | |
progress = "B" | |
for g in 0..number_of_bars do | |
progress = progress + "=" | |
end | |
if number_of_bars > 0 | |
progress = progress + "D" |
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
people = Person.with_status_code_not_as("Pending Federal Benefits Direct Deposit Credit") | |
people.each do |p| | |
next if p.direct_deposit_status.direct_deposit_status_code.to_s == "Rejected" | |
if !p.federal_benefits_enrollments.empty? | |
p.direct_deposit_status.change_status!("Pending Federal Benefits Direct Deposit Credit", p.direct_deposit_status.created_by, nil) | |
end | |
end | |
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
@addon_products = @card.person.account_addon_products.map{|product| product.type.to_s } | |
in view: | |
%td.cardholder-product | |
= @addon_products.to_sentence |