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
(ns my-backend.core | |
(:gen-class) | |
(:require [compojure.core :as c] | |
[compojure.route :as route] | |
[ring.adapter.jetty :as jetty] | |
[ring.middleware.defaults :as ring-defaults] | |
[hiccup2.core :as h] | |
#_[muuntaja.core :as m] | |
[muuntaja.middleware :as muuntaja])) |
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
#!/usr/bin/env -S sbcl --script | |
(load "~/quicklisp/setup") | |
(let ((*standard-output* (make-broadcast-stream))) | |
(ql:quickload "alexandria") | |
(ql:quickload "cl-readline")) | |
(defpackage :sbcli | |
(:use :common-lisp :cffi) | |
(:export sbcli *repl-version* *repl-name* *prompt* *prompt2* *ret* *config-file* |
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
const selector = Machine({ | |
id: 'selector', | |
initial: 'inactive', | |
context: { | |
items: null, | |
value: null, | |
loaded: false, | |
}, | |
states: { | |
inactive: { |
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
const submit_register = async data => data; | |
const update_service = assign((context, event) => { | |
return { service: event.data }; | |
}); | |
const update_language = assign((context, event) => { | |
return { language: event.data }; | |
}); |
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
// login machine actions --------------------------------------------------- // | |
const submit_login = async (context) => { | |
if (!context.email) { | |
show_message('LOGIN_NO_EMAIL_ERROR', 'error'); | |
} | |
if (!context.password) { | |
show_message('LOGIN_NO_PASSWORD_ERROR', 'error'); | |
} |
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
const validate = async () => null; | |
// validation helpers ------------------------------------------------------ // | |
const should_validate = (context) => { | |
return (context.value && | |
((context.leaving && context.validate) || | |
(!context.leaving && context.validated)) | |
) | |
}; |
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
const validate = async () => null; | |
const should_validate = (context) => { | |
return (context.value && | |
((context.leaving && context.validate) || | |
(!context.leaving && context.validated)) | |
) | |
}; | |
const check = async (context) => { |
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
const request = (context) => {}; | |
const build_request_params = () => {}; | |
const make_signal = (context) => { | |
const controller = new AbortController(); | |
context.signal = controller.signal; | |
} | |
const abort_request = (context) => { |
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
const resend_confirmation_machine = { | |
id: 'resendconfirmation', | |
initial: 'inactive', | |
states: { | |
inactive: { | |
always: '#loginform.active', | |
}, | |
active: { | |
on: { | |
'resendconfirmation.email.focus': 'email', |
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
const login_activate_signal = 'login.activate'; | |
const login_deactivate_signal = 'login.deactivate'; | |
const register_activate_signal = 'register.activate'; | |
const register_deactivate_signal = 'register.deactivate'; | |
const send_activate_login = () => { | |
send({ type: login_activate_signal }) | |
}; | |
const send_deactivate_login = () => { |
NewerOlder