slidenumbers: true slidecount: true code: auto(4), text-scale(1), Fira Code list: alignment(left), bullet-character(—)
[.slidenumbers: false]
[.slidenumbers: false]
$ git branch -m master main | |
$ git commit -a -m 'Update CI config' | |
$ git push -u origin main |
-- users | |
select u.* | |
from users u | |
where u.id = 123 | |
order by u.id; | |
-- books | |
select count(*) as b_cnt, | |
b.user_id | |
from books b |
class Operation | |
extend Dry::Effects::Handler.Defer | |
def run_long_something | |
with_defer do | |
transaction do | |
DoSomeBusinessStuff.new.call | |
end | |
end | |
end |
#!/bin/zsh | |
# initial code from https://github.com/denysdovhan/spaceship-prompt/blob/master/sections/git_status.zsh | |
# | |
# Git status | |
# | |
# ------------------------------------------------------------------------------ | |
# Utils (from https://github.com/denysdovhan/spaceship-prompt/blob/master/lib/utils.zsh) |
slidenumbers: true slidecount: true code: auto(4), text-scale(1), Fira Code list: alignment(left), bullet-character(—)
[.slidenumbers: false]
[.slidenumbers: false]
module Prelude | |
class Monadic | |
include Dry::Monads[:maybe, :result, :do] | |
def call(id, item_id) | |
users = [:user] | |
items = [] | |
user, item = yield Maybe(users[id]).and(Maybe(items[item_id])).to_result { | |
'User not found' | |
} |
require 'continuation' | |
@cc = [] | |
def backtrack(*choices) | |
if @cc.empty? | |
raise | |
else | |
@cc.pop.call | |
end |
class SetSearchPath | |
def initialize(app, rom) | |
@app = app | |
@connection = rom.gateways[:default].connection | |
end | |
def call(env) | |
@connection.synchronize do | |
@connection.execute("set seatch_path to #{env['tenant.schema_name']}") | |
@app.call(env) |
puts "What's your name?" | |
name = gets | |
puts "Hello #{name}" |
begin | |
puts "What's your name?" | |
name = gets | |
puts "Hello #{name}" | |
rescue Read => err | |
err.continue("foobar") | |
rescue Write => err | |
err.continue | |
end |