Send multiple emails to different recipients.
# app/mailers/notify_mailer.rb
class NotifyMailer < ApplicationMailer
-- Create a group | |
CREATE ROLE readaccess; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
#Authentification | |
#Notice the authorization.refresh!. | |
def get_drive_service(user) | |
authorization = Signet::OAuth2::Client.new( | |
:client_id => 'example', | |
:client_secret => 'example', | |
access_token: user.access_token, | |
refresh_token: user.refresh_token, | |
token_credential_uri: 'https://www.googleapis.com/oauth2/v3/token') | |
drive_service = Google::Apis::DriveV3::DriveService.new |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import sys | |
import base64 | |
key = "" | |
class AuthHandler(SimpleHTTPRequestHandler): | |
''' Main class to present webpages and authentication. ''' | |
def do_HEAD(self): |
"For comprehension" is a another syntaxe to use map
, flatMap
and withFilter
(or filter) methods.
yield
keyword is used to aggregate values in the resulting structure.
This composition can be used on any type implementing this methods, like List
, Option
, Future
...