Skip to content

Instantly share code, notes, and snippets.

Why Keechma?

Here are some of my thoughts related to Keechma and why you should try it out…

Unlike the “Keechma Design Decisions” post, this one is purely subjective, and appealing to your emotions.

Globals

Globals are bad.

-- Function: clone_schema(text, text)
DROP FUNCTION clone_schema(text, text);
CREATE OR REPLACE FUNCTION clone_schema(source_schema text, dest_schema text)
RETURNS void AS
$BODY$
DECLARE
seq RECORD;
;; Pipelines are a new way to write controller action handlers for Keechma.
;; They are a part of the (soon-to-be-released) Keechma Toolbox - https://github.com/keechma/keechma-toolbox
;;
;; In this case we implemented a live Movie Search (it's hitting http://www.omdbapi.com/) where the pipeline is called on every
;; keypress, and makes request after a 500ms timeout. This pipeline is exclusive so if a pipeline is running when the next
;; keypress happens, it will be cancelled (along with the AJAX request) and another pipeline will be started.
;;
;; https://github.com/keechma/keechma-toolbox/tree/master/src/cljs/keechma/toolbox/pipeline
(def search-controller
(ns app-name.middleware.cors
"Ring middleware for Cross-Origin Resource Sharing."
(:require [clojure.set :as set]
[clojure.string :as str]
[macchiato.util.response :as r :refer [get-header]]))
(defn origin
"Returns the Origin request header."
[request] (get-header request "origin"))
WITH "cte-133417" AS MATERIALIZED (
SELECT
"film"."film_id" AS "film-id",
"film"."title" AS "title"
FROM
"film" AS "film"
ORDER BY
"film"."title" FETCH NEXT 5 ROWS ONLY
)
SELECT
@retro
retro / backend.ts
Created November 27, 2024 07:09
Durable components demo code
import { Effect, pipe, Schema, Fiber, Array } from "effect";
import { Component, State, Endpoint, Api, type GetAppType } from "@repo/core";
import OpenAI from "openai";
import { zodResponseFormat } from "openai/helpers/zod.mjs";
import { z } from "zod";
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
organization: process.env.OPENAI_ORGANIZATION,
});