sequenceDiagram
participant John as John
participant DB as Database
participant Mary as Mary
John->>DB: begin_transaction()
Note over DB: Lock acquired on source & dest accounts
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
// ----------------------------------------------- | |
// OOP dependency injection (the repository implementation can be switched in runtime) | |
// ----------------------------------------------- | |
class UserService { | |
constructor(userRepository) { | |
this.userRepository = userRepository | |
} | |
create(params) { | |
validate(params) |
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
version: '3.3' | |
services: | |
pg: | |
image: postgres:10 | |
volumes: | |
- pg_data:/var/lib/postgresql/data | |
ports: | |
- 5432:5432 | |
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
# ruby --version | |
# ruby 2.6.3p62 | |
require 'benchmark' | |
def without_splat(a, b, c); end | |
def with_splat(*a); end |
const R = require('ramda');
const users = [
{ ses: { sesCreds: 1 }, senders: [{ sender: 11 }, { sender: 12 }, { sender: 13 }] },
{ ses: { sesCreds: 2 }, senders: [{ sender: 21 }, { sender: 22 }, { sender: 23 }] },
{ ses: { sesCreds: 3 }, senders: [{ sender: 31 }, { sender: 32 }, { sender: 33 }] }
];
const notificationTypes = ['Bounce', 'Complaint'];
const { forEach, fromIter, map, filter, pipe, interval, take, fromPromise, flatten } = require('callbag-basics');
const request = require('request-promise');
const Promise = require('bluebird');
const events = [
{ type: 'event', value: 1 },
{ type: 'event', value: 2 },
{ type: 'event', value: 3 },
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
// This is meant to be executed periodically, adapt it depending on you sell pace | |
// or create reports for previous weeks instead of using doing it in realtime. | |
var moment = Moment.load(); | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var startOfLastWeek = moment.utc().startOf('week').add(1, 'd'); | |
var endOfLastWeek = moment.utc().endOf('week').add(1, 'd'); | |
Logger.log('Week starts: ' + startOfLastWeek.toString()); | |
Logger.log('Week ends: ' + endOfLastWeek.toString()); |
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 Email::Validate | |
def self.call(email) | |
new(email, RFC::CheckSyntaxt, SMTP::CheckUserExistance).call | |
end | |
attr_reader :email, :rfc_check_syntaxt, :smtp_check_user | |
def initialize(email, rfc_check_syntaxt, smtp_check_user) | |
@email = email | |
@rfc_check_syntaxt = rfc_check_syntaxt |
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 Shape | |
def initialize(color) | |
@color = color | |
end | |
def repr | |
raise 'Abstract method, to be implemented on subclasses' | |
end | |
def draw |
NewerOlder