Skip to content

Instantly share code, notes, and snippets.

@rlander
rlander / gist:a1d18e6ec693736fddd25ab3f1fb91b7
Created May 11, 2021 21:36 — forked from JLarky/gist:3849736
erlang ultimate debug macro
% use like ?DEBUG_CALL({simple_test, Status, get_value(X)}).
% or even 2 = ?DEBUG_CALL(if true -> 1+1 end).
-define(DEBUG_CALL(Args), (fun() -> DEBUG_CALL = (Args), error_logger:info_msg("~w:~w -> ~s:~n ~150p~n", [?MODULE, ?LINE, ??Args, DEBUG_CALL]), DEBUG_CALL end)()).
@rlander
rlander / main.clj
Created April 6, 2022 13:26 — forked from mtnygard/main.clj
Use macros to make nested try/catch with values less of an eyesore.
(defn -main
[& args]
(let [file (try-> args
parse-args
(:! clojure.lang.ExceptionInfo ei (fe/print-other-exception ei))
:filename)]
(when (and file (not= ::try/exit file))
(try-> file
fern/load-from-file
(:! java.io.FileNotFoundException fnfe (fe/print-error-message (str "File not found: " (pr-str (.getMessage fnfe)))))

For example, to override the AppBar (https://material-ui-next.com/api/app-bar/) root class we can do the following:

First method (override Material UI classnames):

1 - Add the property classes in the AppBar component:

    <AppBar classes={{root: 'my-root-class'}}
@rlander
rlander / dev_server.clj
Created January 21, 2023 00:08 — forked from ian-moore/dev_server.clj
shadow-cljs dev http server with conditional proxy requests
(ns my-shadow-app.dev-server
(:require [clj-http.client :as client]
[clojure.string :as string]
[shadow.http.push-state :as push-state])
(:import [org.apache.http NoHttpResponseException]))
(defn handler
[{:keys [uri http-config body headers request-method] :as request}]
(if-not (string/starts-with? uri "/api")
(push-state/handle request)