Skip to content

Instantly share code, notes, and snippets.

View wpeterson's full-sized avatar

Winfield Peterson wpeterson

View GitHub Profile
class Post < ActiveRecord::Base
validates_presence_of :poster_id, :class_name => "User"
state_machine :type do
state :topic do
validates_presence_of :subject, :forum_id
has_many :posts, :foreign_key => 'topic_id'
end
state :post do
validates_presence_of :topic_id
INSERT INTO user_blacklisted_tags (user_id, tag_id, created_at, updated_at) VALUES (
(
SELECT id FROM users
WHERE disease_id
IN (12) AND
users.id NOT IN (47479,53763,16596,25972,13185,48185,71438,38883,48974,33480,65640,73067,60292,76512,30192,20260,39597,33017,65233,9992,35659,10845,76534,10434,70718,49242,3659,18607,7734,37208,14073,30810,62107,20031,9117,46134,24706,11833,41968,23498,16637,40927,35025,17,17256,21279,28152,39995,16891,49446,11270,36465,46435,24231,50815,50903,31054,43088,52059,36481,54280,59,53647,38864,53348,19060,18298,50691,48272,3775,37787,46221,12632,14213,34881,35067,54880,40967,53177,57007,12722,64738,64337,72241,16085,60917,26094,74276,61587,50244,7453,7629,51448,65743,66534,18954,53534,67382,78343,30032,81890,81879,70943,72638,49028,71921,42936,36925)),
494,
'2010-04-15 15:18:07',
'2010-04-15 15:18:07'
)
<VirtualHost *:80>
ServerName local.plm
ServerAlias www.local.plm
DocumentRoot /Users/winfield/src/plm-website/public
ExpiresDefault "access plus 1 day"
ErrorDocument 401 /500.html
ErrorDocument 403 /500.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
Survey Validations - James
Yellow Prompts: Reminders & Surveys - Mav
Sympom Merges - Ben/Jeffrey?
Suspended Surveys - Winfield
Survey Invite Tracking - Keenan
Survey Emails - Keenan
Survey Reminders - Jeffrey
Fibro Flash Charts - Doug
# Performance benchmark of native Ruby MD5 digest vs. shelling out
# to openssl md5 utility. Benchmark clearly shows shelling out is
# massively slower, as you might expect.
#
# [master ~/src/cloudfront_asset_host]$> ruby md5_benchmark.rb
# Openssl: 0.110000 0.650000 5.220000 ( 7.547728)
# Native: 0.020000 0.010000 0.030000 ( 0.031182)
require 'benchmark'
require 'digest/md5'
start_date = 5.years.ago.to_date
end_date = Date.today
manufacturer = Manufacturer.find_by_name! 'UCB Inc.'
search_opts = {'start_date' => start_date, 'end_date' => end_date, 'manufacturer' => manufacturer}
puts "Line Listing for #{search_opts.inspect}..."
search = Search.new(search_opts)
events = DrugSafety::Event.for_line_listing_report(search)
puts "Found #{events.size} events."
Leaders Work - Jeffrey & Michael, Adam
PLM in Motion - Cris & Winfield
Condition Info - Mav, Michael, Jeffrey, Cris, and Adam
Disease DMT Tracking - Keenan
Drug Safety Outcome Search - Michael
Treatment Brand Names - Michael
Currently Taking Patient List - Michael
MedDRA Upgrade - James
Flash Charting, maybe PD charts - Doug
PV Performance/Background - Mav
source 'http://rubygems.org'
gem 'rails', '3.0.0'
# Deploy with Capistrano
gem 'capistrano'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
acceptcheck
Designer: FatCow Web Hosting
License:Creative Commons (Attribution 3.0 United States)
Size: 32 x 32 px
Icon set: Farm-fresh ( Show all icons in this icon set)
http://www.mricons.com/icon/118067/32/accept-check-icon http://www.fatcow.com/
@wpeterson
wpeterson / coding_project.rb
Created October 18, 2010 00:22
Here's Bob's Coding Challenge
state_machine :state, :initial => :applied do
before_transition(any => :applied) {|r, t| r.applied_at = Time.now }
before_transition(any => :screened) {|r, t| r.screened_at = Time.now }
before_transition(any => :interview) {|r, t| r.interview_at = Time.now }
before_transition(any => :rejected) {|r, t| r.rejected_at = Time.now }
before_transition(any => :hired) {|r, t| r.hired_at = Time.now }
before_transition(any => :disabled) {|r, t| r.disabled_at = Time.now }
after_transition(any => :hired) {|r, t| r.update_attribute(:kind, 'Employee')}