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 "digest" | |
require "rack" | |
# This class encapsulates a unit of work done for a particular tenant, connected to that tenant's database. | |
# ActiveRecord makes it _very_ hard to do in a simple manner and clever stuff is required, but it is knowable. | |
# | |
# What this class provides is a "misuse" of the database "roles" of ActiveRecord to have a role per tenant. | |
# If all the tenants are predefined, it can be done roughly so: | |
# | |
# ActiveRecord::Base.legacy_connection_handling = false if ActiveRecord::Base.respond_to?(:legacy_connection_handling) |
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
# mailboxes/concerns/mail_params.rb | |
module MailParams | |
extend ActiveSupport::Concern | |
def mail_params | |
attachments = build_attachments | |
body = build_rich_body(attachments) | |
{ subject: mail.subject, body: body, attachments: attachments.map { |a| a[:blob] } } | |
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
find: | |
\'(\w+)\'\s*=> | |
replace: | |
$1: | |
replace symbol hash rockets with new syntax | |
find: |
# Start by stopping the built-in Apache, if it's running, and prevent it from starting on boot.
# This is one of very few times you'll need to use sudo:
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
# We need to tap homebrew-dupes because "homebrew-apache/httpd22" relies on "homebrew-dupes/zlib"
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 api = "yourApiUrlGoesHere"; | |
/* | |
Method to do a GET request to the service | |
*/ | |
var getService = function (uri, failureFunction, errorFunction, successFunction) | |
{ | |
$.ajax({ | |
cache: true, | |
url: api+uri, |