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
# Run with iex -S mix run script/verify | |
defmodule Pitch.VerifyPush do | |
@valid_tokens [ | |
"7a61a279e0a35396d08ce13131fa6e2278a404f53683f17a16e1d6566223c712" # add more here | |
] | |
@number_of_bad_tokens 10 | |
@pool :my_pool_name |
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
# Use | |
DateTime.parse("2012-03-25 03:29").in_time_zone(Time.zone) | |
# Instead of | |
Time.zone.parse("2012-03-25 03:29") | |
# Until the pull request https://github.com/jarkko/rails/commit/bb4a1d68f6db8bf99d2b6e21eee72a19d494dee0 has been pulled into Rails. |
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
class ParentRegistartionValidator < ActiveModel::Validator | |
def validate(record) | |
record.errors.add(:weight, :blank) unless record.weight.present? | |
... | |
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
var occurrences = $(".occurrences"); | |
if(occurrences.find(".error").length > 0) { | |
occurrences.find("a.add").hide(); | |
} else { | |
occurrences.find(".fields:not(:has(input[type='checkbox'])):not(:first)").hide(); | |
occurrences.find("a.add").click(function(e) { | |
var prevOccurrence = occurrences.find(".fields:not(:hidden):last"); | |
var nextOccurrence = occurrences.find(".fields:hidden:first"); | |
var inputs = "input[type='text'], select"; |
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
describe 'TaskNavigator', -> | |
template 'task_panel.html' | |
beforeEach -> | |
@taskNavigator = new TaskNavigator() | |
@taskNavigator.showSection.load = => | |
$(".show").html(Evergreen.templates["task_show.html"]) | |
@taskNavigator.bindEvents() |
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
module XPath | |
extend self | |
def self.generate | |
yield(Expression::Self.new) | |
end | |
class Expression | |
include XPath |
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 test_default_values_are_not_changable_by_the_instances_when_dupable | |
define_model_class do | |
set_table_name "users" | |
default_value_for :username, "hello" | |
end | |
user1 = TestClass.new | |
user1.username << " world" | |
user2 = TestClass.new | |
assert_equal("hello", user2.username) | |
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
class CallsController < ApplicationController | |
calls_controller | |
before_filter :resource, :only => [:create, :destroy] | |
before_filter :check_for_valid_call, :only => [:update, :destroy, :show] | |
before_filter :check_for_other_call, :only => [:create] | |
def create | |
@patient.calls << PatientCall.new | |
begin |
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
1) | |
'Patient#past_follow_ups with a follow up in the past returns the past follow up' FAILED | |
expected: [#<Communication _id: 4bd6c993f7e2f01471003ed1, label: "Fern F Block", pdf_filename: nil, report_start_date: nil, body: nil, parent_communication_id: nil, campaign_id: nil, delivery_method: "Phone", completed_comment: nil, occurred_at: nil, imported: false, patient_id: "4bd6c993f7e2f01471003ecf", reviewed: false, intervention_id: nil, follow_up_date_and_time: Tue Apr 27 12:00:00 UTC 2010, document_template_id: nil, description: "Technician scheduled follow up call.", delivered_by_id: nil, target: "4bd6c993f7e2f01471003ecf", organization_id: "4bd6c96ff7e2f01471001cd8", scheduled_at: nil, report_end_date: nil, status: "unsent", polling_token: nil, managed_by_pharmmd: true, status_message: nil, target_type: "Patient">], | |
got: [] (using ==) | |
./spec/models/patient_spec.rb:840: | |
2) | |
'Patient#past_follow_ups with follow ups in the future & past returns the past follow up' FAILED | |
expected: [#<Communication _id: 4bd |