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
# put this in ~/.inputrc | |
# Edit commands in Vi mode | |
set editing-mode vi | |
set keymap vi |
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 this file in RAILS_ROOT with watchr | |
# | |
# .watchr template file for rspec test suite | |
# | |
# watch all the spec files | |
watch( '^spec/(.*)/(.*)\.rb' ) { |md| | |
system("spec #{md[0]} --drb --colour --format progress") | |
} | |
# watch the associated files in a rails project |
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
# also see the example from the jQuery site: http://docs.jquery.com/Attributes/removeAttr#name | |
$("#form-id input, #form-id select").removeAttr("disabled"); |
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
# New way of handling both HTML and AJAX requests RESTfully in the view templates | |
# Below are the (uncommitted) changes I've made to the contacts views | |
# contacts/index.html.erb | |
<%= render :partial => 'patients/patientnav', :locals => {:page => "demographics"} %> | |
<div id="patient_section" class="casecontent"> | |
<%= render :partial => "index" %> | |
</div> | |
<%= render :partial => 'patients/patientnavend' %> |
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
# the restrict_access_to method would operate essentially identical to | |
# a before_filter, I just like how it reads a little better than a before filter | |
class PatientsController < ApplicationController | |
restrict_access_to [:therapists, :accountants, :practice_admins], :on => :all | |
before_filter :check_patient_signoff | |
end | |
class BillingController < ApplicationController |
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
# at the top of any controller example, you need to add in the stub_request_before_filters | |
# method, which will take care of everything that ApplicationController requires before | |
# passing the request on to the actual requested Controller#action. | |
# | |
# The stub_request_before_filters method is defined in lib/optimis_test_helpers.rb | |
# and is included in spec/spec_helper.rb | |
describe PatientsController do | |
before(:each) do | |
stub_request_before_filters |
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 File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe PatientVisitsController do | |
before(:each) do | |
stub_request_before_filters | |
end | |
describe "GET index /patients/1/patient_visits" do | |
before(:each) do | |
@patient = mock_model Patient |
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
# Method to provide some syntactic sugar to use a hash of options instead of normal | |
# arguments, where you want an ArgumentError thrown if the proper keys aren't passed | |
# in, but you want the syntactic sugar of hash keys. | |
# | |
# Example | |
# ======= | |
# require_options!({ :name => "John Doe", :age => 24 }, :name, :age, :sex) | |
# # => raises an ArgumentError | |
# | |
def require_options!(opts, *required_options) |
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 OptimisMatchers | |
def self.generate_matcher(matcher_name, url) | |
OptimisMatchers::module_eval do | |
Spec::Matchers.define matcher_name do | |
match do |actual| | |
actual.redirect_url == url | |
end | |
failure_message_for_should do |actual| |
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 'rubygems' | |
require 'yaml' | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
require 'httparty' | |
class NotifyCampfire | |
include HTTParty |