- Install Dependencies
npm init npm install --save-dev ts-node typescript tslib express @types/express
- Create
server.ts
in root folder of your app.
#!/usr/bin/env bb | |
(ns reorder | |
(:require [clojure.java.io :as io] | |
[clojure.string :as string] | |
[rewrite-clj.node :as n] | |
[rewrite-clj.zip :as z] | |
[rewrite-clj.zip.subedit :as zsub]) | |
(:import (java.io File StringWriter))) | |
(defn- top? [loc] |
(ns analyze.core | |
(:require [clj-kondo.core :as clj-kondo] | |
[clojure.set :as set])) | |
;; checks re-frame's :<- syntax | |
;; to mark dependency subscriptions as used | |
(def analyze-reg-sub | |
"(require '[clj-kondo.hooks-api :as api]) | |
(fn [{node :node}] | |
(let [[_ kw & children] (:children node) |
// dm Klopapier Widget | |
// | |
// Copyright (C) 2020 by marco79 <[email protected]> | |
// | |
// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL | |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$ | |
DECLARE | |
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes'); | |
BEGIN | |
IF TG_OP = 'INSERT' THEN | |
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}'); | |
RETURN NEW; | |
END IF; | |
IF TG_OP = 'DELETE' THEN | |
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}'); |
; Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/ | |
; in project.clj dependencies | |
; [com.impossibl.pgjdbc-ng/pgjdbc-ng "0.5"] | |
(ns pglisten.core | |
(:import [com.impossibl.postgres.jdbc PGDataSource] | |
[com.impossibl.postgres.api.jdbc PGNotificationListener])) |
(ns app.logging | |
(:refer-clojure :exclude [time]) | |
(:require #?(:clj [clojure.tools.logging :as log] | |
:cljs [goog.log :as glog])) | |
#?(:cljs (:import goog.debug.Console))) | |
#?(:cljs | |
(def logger | |
(glog/getLogger "app"))) |
(ns localstorage) | |
(defn set-item! | |
"Set `key' in browser's localStorage to `val`." | |
[key val] | |
(.setItem (.-localStorage js/window) key val)) | |
(defn get-item | |
"Returns value of `key' from browser's localStorage." | |
[key] |
(ns async-test.timeout.core | |
(:require [cljs.core.async :refer [chan close!]]) | |
(:require-macros | |
[cljs.core.async.macros :as m :refer [go]])) | |
(defn timeout [ms] | |
(let [c (chan)] | |
(js/setTimeout (fn [] (close! c)) ms) | |
c)) | |