Skip to content

Instantly share code, notes, and snippets.

def ensure_clinician_is_logged_in
respond_to do |format|
format.html { redirect_to "/clinicians/sign_in#{build_url_query}" unless current_clinician }
format.json do
response.headers['REQUIRES_AUTH'] = '1'
render js: "/clinicians/sign_in#{build_json_query}" unless current_clinician
end
end
end
@garlou
garlou / index.ts
Created April 7, 2021 10:50
Send raw email with attachment with AWS SES using Typescript
/*
* This solution was built based on stackoverflow answer https://stackoverflow.com/a/54233102
* placed by user https://stackoverflow.com/users/2485910/snowball
*/
import AWS from 'aws-sdk';
import {Template} from 'aws-sdk/clients/ses';
interface Attachment {
encoding: 'base64';