The diff was applied to 3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0. After applying, the :Git window
looks like (green/red coloring):
Head: my-branch
Help: g?
Untracked (1)
? file_1.txt
The diff was applied to 3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0. After applying, the :Git window
looks like (green/red coloring):
Head: my-branch
Help: g?
Untracked (1)
? file_1.txt
| diff --git a/xtdb2-starter/deps.edn b/xtdb2-starter/deps.edn | |
| index 84fd90a..2649ab1 100644 | |
| --- a/xtdb2-starter/deps.edn | |
| +++ b/xtdb2-starter/deps.edn | |
| @@ -1,6 +1,14 @@ | |
| {:paths ["src" "resources" "target/resources"] | |
| - :deps {com.biffweb/biff {:local/root ".."} | |
| - cheshire/cheshire {:mvn/version "6.1.0"} | |
| + :deps {com.biffweb/biff {:local/root ".." | |
| + :exclusions [com.xtdb/xtdb-core |
| call plug#begin() | |
| function! DoRemote(arg) | |
| UpdateRemotePlugins | |
| endfunction | |
| Plug 'tpope/vim-sexp-mappings-for-regular-people' | |
| Plug 'guns/vim-sexp' | |
| "Plug 'tpope/vim-repeat' " TODO fix the error this triggers on undo | |
| Plug 'tpope/vim-surround' |
| import time | |
| from fastapi import Request | |
| from starlette.middleware.base import BaseHTTPMiddleware | |
| from contextlib import contextmanager | |
| from collections import defaultdict | |
| import threading | |
| _profiling_data = threading.local() | |
| @contextmanager |
| (ns com.biffweb.impl.index | |
| (:require [taoensso.nippy :as nippy]) | |
| (:import java.util.Map | |
| java.util.HashMap | |
| java.util.function.Function | |
| (java.io Closeable File) | |
| (java.nio.file Files Path) | |
| java.nio.file.attribute.FileAttribute | |
| (org.rocksdb BlockBasedTableConfig Checkpoint CompressionType FlushOptions LRUCache | |
| DBOptions Options ReadOptions RocksDB RocksIterator |
| (defattr newsletter-subs :user/email-subscriptions [:vector :biff.attr/ref] | |
| {:biff.attr/input [:xt/id] | |
| :biff.attr/output [{:user/email-subscriptions [:sub/user | |
| :sub/newsletter | |
| :sub/kind | |
| :sub/unread | |
| :sub/last-published | |
| :sub/pinned | |
| :sub/total | |
| :sub/read]}]} |
Adding fields to the signup form is more complex than just setting a custom :biff.auth/new-user-tx function because both
authentication flows (email link and six-digit code) include multiple requests (e.g. in the email link flow, first you submit
a form with your email address, then you click a link), and new-user-tx doesn't get called until the last request. So we
have to modify the auth flows to take the extra form params from the first request and propagate them so that new-user-tx
has access to them.
Below is a diff of the starter app showing exactly how to do that. First, you'll need to copy over the authentication module
code into your project, as demonstrated in
step 4 of the Postgres howto. Then apply the changes in the diff
below to your auth.clj file. Remove the com.biffweb.impl.* namespaces and use a single [com.biffweb :as biff] require instead.
These are some examples of using the Stripe API in a Clojure/Biff app, taken verbatim from Yakread. For more details, see the Stripe documentation. For the most part I recommend using the REST API directly rather than going through the Java SDK.
Yakread has an advertising page that lets you connect a credit card via Stripe checkout. The card is charged later, after your advertisement has run.
Here's some of the code for the advertising page:
| call plug#begin() | |
| function! DoRemote(arg) | |
| UpdateRemotePlugins | |
| endfunction | |
| Plug 'tpope/vim-sexp-mappings-for-regular-people' | |
| Plug 'guns/vim-sexp' | |
| Plug 'tpope/vim-repeat' | |
| Plug 'tpope/vim-surround' |
Put this in .dir-locals.el:
((nil . ((cider-preferred-build-tool . babashka)
(cider-babashka-parameters . "dev"))))