Skip to content

Instantly share code, notes, and snippets.

View stevencwarren's full-sized avatar

Steven Warren stevencwarren

View GitHub Profile
App.Project = DS.Model.extend(
title: DS.attr("string", defaultValue: 'Please enter a title')
created_at: DS.attr('date')
updated_at: DS.attr('date')
status: DS.attr('string')
cover_image_url: DS.attr('string', defaultValue: '')
cover_image_thumb_url: DS.attr('string', defaultValue: '')
cover_image_show_url: DS.attr('string', defaultValue: '')
owner: DS.belongsTo('App.User')
description: DS.attr('string')
class ProjectSerializer < ActiveModel::Serializer
attributes :id, :title, :status, :owner, :description, :created_at, :updated_at, :cover_image_url, :cover_image_thumb_url, :cover_image_show_url
def cover_image_thumb_url
object.cover_image.url(:thumb)
end
def cover_image_show_url
object.cover_image.url(:show)
end
def self.index(params)
projects = scoped
projects = projects.order "#{params[:order_field]} #{params[:order_direction]}" if params[:order_field] && params[:order_direction]
projects = projects.limit params[:limit] if params[:limit]
projects
end
class Api::ProjectsController < Api::ApiController
respond_to :json, :xml
def create
@project = Project.new params[:project]
if @project.save
return @project
else
return [ @project,:status => :unprocessable_entity ]
end
Select outcomes, inverted_outcomes, sum(outcomes,inverted_outcomes) as goals_met
FROM
(SELECT Count(outcome_records) FROM "visits"
INNER JOIN progress_reports ON progress_reports.visit_id = visits.id
INNER JOIN outcome_records ON progress_reports.id = outcome_records.progress_report_id
INNER JOIN outcome_goals ON outcome_records.goal_id = outcome_goals.id
WHERE ends_on IS NOT NULL
AND outcome_records.integer_value IS NOT null
AND progress_reports.final is true
AND outcome_goals.inverted is false
context "The article is an ebsco article" do
before(:each) do
@ea = Factory(:ebsco_article, :teaser => '<p>\r\n\t&nbsp;</p>\r\n<p>teaser text</p>', :text => '<p>\r\n\t&nbsp;</p>\r\n<p>body text</p>')
end
it "should not call p clean on the teaser" do
@ea.teaser.should == '<p>\r\n\t&nbsp;</p>\r\n<p>teaser text</p>'
end
it "should not call p clean on the text" do
FactoryGirl.define do
factory :resource do
title 'Resrouce Test'
author_name 'George Costanza'
author_bio 'Once upon some time...'
text 'Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante. Maecenas tellus. Maecenas erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.'
published_at Date.today
user
end
startup_message off
#caption always '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%D %Y-%m-%d %{W}%c %{g}]'
altscreen on
vbell off
termcapinfo xterm ti@:te@
#shell -$SHELL
escape ^Jj
defscrollback 5000
<table width="600">
<tbody>
<tr>
<td style="padding:15px;">
<%= @user.first_name %>,
<p>A request to reset your Pearlpoint.org password has been made.</p>
<p>If you did not make this request, please ignore this email.</p>
def chart_health_tracker_data(health_tracker_entry_list, header, method, days_back = 7)
start_day = Date.today - days_back + 1
day_labels = []
exercise_points = []
calorie_points = []
weight_points = []
table = [header]
#iterate through the days and store points
start_day.step(start_day + days_back - 1, 1) {|day|
result = 0