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
class WebRequest | |
MOBILE_USER_AGENTS = r/palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\.b|webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|mobile/i | |
attr_reader :time, :ip, :referer, :user_agent | |
def initialize(time, ip, referer, user_agent) | |
@time = time | |
@ip = ip | |
@referer = referer | |
@user_agent = user_agent |
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
# Helper for PostgreSQL Sequences | |
# USAGE: | |
# SequenceHelper.nextval('somenumber_seq') | |
# SequenceHelper.currval('somenumber_seq') | |
# SequenceHelper.reset('somenumber_seq', 10) | |
class SequenceHelper < ActiveRecord::Base | |
# Verify that the sequence exists or create it | |
def self.verify(name, create = true, initial_value=1) | |
name.downcase! |
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
begin; | |
/* | |
Problem: I don't want the application to really care about how the data is | |
structured in the database. The application / view code needs to work | |
with the data in a sane format, without worrying about normalization, joins, | |
eager fetching, etc. | |
DB Schema Overview: | |
orders |