Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am msf on github.
  • I am m3thos (https://keybase.io/m3thos) on keybase.
  • I have a public key whose fingerprint is 4A25 2811 7100 C10C 329F 0ACD C583 AA4E DDED 138C

To claim this, I am signing this object:

@bp.route('/create/', methods=['POST'], endpoint='create')
def create():
input = createInputFromForm(request.form)
handler = get_app_handler()
app = handler.create(input.name, input.description)
return redirect(url_for('app.show', app_id=app.id), code=301)
def get_app_handler():
from services.app.create import create_app
from services.update import update_app
from services.delete import delete_app
from repositories.app import delete_app, find_app_by_id, idempotent_save_app
class AppHandler(object):
def create(self, name: str, description: str) -> Entity:
if not validate_create_input(name, description):
...
app = create_app(name, description)
import repository
def create_app(name, description):
validate_app_name(name)
return repository.create_app(name, description)
from values.app import App
from repository.sqlalchemy.entities import DBApp
from repository.sqlalchemy.sessions import Session
def find_app_by_id(app_id):
db_app = DBApp.query.get(id=app_id)
if not db_app:
return None
@msf
msf / values.py
Last active January 13, 2020 18:27 — forked from marcelolebre/value_nesting.py
@dataclass
class User:
username: str
email: str
first_name: str
last_name: str
@classmethod
def from_db(cls, db_user):
return cls(
@msf
msf / chacha20-roundtrip.html
Last active December 16, 2022 19:02
add back fromHex()
<!DOCTYPE html>
<html>
<body>
<h2>My Heading</h2>
<p>Play around with the code and click on the "Run" button to view the result.</p>
<p id="demo"></p>
Building C object CMakeFiles/zig1.dir/zig1.c.o
[ 63%] Linking CXX static library zigcpp/libzigcpp.a
[ 63%] Built target zigcpp
[ 68%] Linking C executable zig1
[ 68%] Built target zig1
[ 73%] Running zig1.wasm to produce /home/miguel/zig/zig-bootstrap/out/build-zig-host/zig2.c
[ 78%] Running zig1.wasm to produce /home/miguel/zig/zig-bootstrap/out/build-zig-host/compiler_rt.c
[ 84%] Building C object CMakeFiles/zig2.dir/zig2.c.o
[ 89%] Building C object CMakeFiles/zig2.dir/compiler_rt.c.o
[ 94%] Linking CXX executable zig2