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
require 'irb/completion' | |
require 'irb/ext/save-history' | |
ARGV.concat [ "--readline", | |
"--prompt-mode", | |
"simple" ] | |
# 1500 entries in the list | |
IRB.conf[:SAVE_HISTORY] = 1500 |
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 DevelopmentMailInterceptor | |
def self.delivering_email(message) | |
message.subject = "#{message.to} #{message.subject}" | |
message.to = "jason@resipsalaw.com" | |
end | |
end | |
ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development? |
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 Contact < ActiveRecord::Base | |
# Elastic Search | |
include Tire::Model::Search | |
include Tire::Model::Callbacks | |
# Unique Index | |
include Tire::UniqueIndex | |
unique_index :account_id |
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
module Api | |
module Methods | |
extend ActiveSupport::Concern | |
included do | |
def self.api_define(&block) | |
class_eval %Q{ | |
module Methods | |
#{yield} |
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
{ "api": "Providers API", | |
"description": "An api to access providers", | |
"url": "https://api.itriagehealth.com/api/v1/providers", | |
"resources": [ | |
"medical_facilities", | |
"physicians" | |
] | |
} |
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
MedicalFacility.joins(:medical_facility_categories).where('medical_facility_categories.id !=4 AND physician_id IS NOT NULL').count | |
=> 45 | |
MedicalFacility.joins(:medical_facility_categories).where('medical_facility_categories.id !=4 AND physician_id IS NOT NULL').each { |r| r.medical_facility_categories << MedicalFacilityCategory.find(4) } | |
MedicalFacility.joins(:medical_facility_categories).where('medical_facility_categories.id !=4 AND physician_id IS NOT NULL').count | |
=> 45 | |
# Wtf? |
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
module Penis | |
def self.included(base) | |
puts "Making Babies!" | |
end | |
end | |
class Vagina | |
include Penis | |
end |
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
module OauthResource::ThreadLocal | |
def thread_local_accessor(*names) | |
names.each do |name| | |
class_variable_set :"@@#{name}", {} | |
accessor = class_variable_get("@@#{name}") | |
# Thread Accessor Getter | |
define_singleton_method name do | |
thread_id = Thread.current.object_id | |
accessor[thread_id] |
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
{ | |
"resource": "Widget", | |
"description": "Api for Widget", | |
"attributes": [ | |
"id", | |
"account_id", | |
"key", | |
"name", | |
"default_location", | |
"custom_pages", |
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
module JSON | |
def self.parse(string) | |
# replace "key":"val" with "key" => "val", and evaluate | |
eval string.gsub(/(".[^"]+"):/, "\\1 => ") | |
end | |
def self.null | |
nil | |
end |
OlderNewer