Skip to content

Instantly share code, notes, and snippets.


Maurício Szabo mauricioszabo

View GitHub Profile
mauricioszabo /
Created Aug 31, 2021
Squash and lost history
╰─>$ git checkout -b feature-branch
Switched to a new branch 'feature-branch'
╰─>$ git commit -a -m 'Commit 2'
[feature-branch 1f16b96] Commit 2
1 file changed, 1 insertion(+)
╰─>$ git commit -a -m 'Commit 3'
[feature-branch f7c9f08] Commit 3
1 file changed, 1 insertion(+)
mauricioszabo / dependencies
Created Jun 13, 2021
Parallel Consumer Example
View dependencies
[io.confluent.parallelconsumer/parallel-consumer-core ""]
[fundingcircle/jackdaw "0.8.0"]
mauricioszabo / chlorine-config.cljs
Created Apr 13, 2021
Chlorine Config for custom resolver of goto var definition
View chlorine-config.cljs
(defn- get-resolver-for-keyword [k]
(p/let [{:keys [text]} (editor/get-namespace)
namespace (str/replace text #"(.*?\.).*" "$1")
res (editor/run-feature :eql [{(list :repl/namespaces {:filter namespace})
[:repl/namespace {:namespace/vars [:var/fqn]}]}])
vars (for [{:namespace/keys [vars]} (:repl/namespaces res)
{:var/keys [fqn]} vars]
code (str "(->> " (vec vars)
" (filter (fn [r] (-> r :com.wsscode.pathom.connect/output set (contains? " k "))))"
mauricioszabo / neverending.psql
Created Jan 7, 2021
PostgreSQL example of recursive queries
View neverending.psql
INSERT INTO tree (id, parent_id, description)
(6, 6, 'Im Recursive');
WITH RECURSIVE parents as (
select id,
from tree
where parent_id = 6
mauricioszabo /
Created Dec 5, 2020
My current Chlorine config file

To make this code above work, you'll have to add some dependencies on ~/.atom/chlorine - they are used mostly for the custom tags here:

In file ~/.atom/chlorine/nomno.js 
module.exports = require('nomnoml');

In file ~/.atom/chlorine/hpcc-js.js 
const hpcc = require('@hpcc-js/wasm')
hpcc.wasmFolder(__dirname + "/node_modules/@hpcc-js/wasm/dist")
module.exports = hpcc
mauricioszabo / account.rb
Created Nov 28, 2020
Autoimport problems in Rails
View account.rb
class Account
def to_json(*args)
{amount: BigDecimal("200")}.to_json
View core.clj
(ns example.core
(:require [vcr-clj.core :as vcr]
[vcr-clj.clj-http :as vcr-http]
[clj-http.client :as client]))
(defn random [n]
{:number (+ 10 (rand-int n))
:username "admin"
:password "Lol, Ima Password!"})
mauricioszabo / query.clj
Created Oct 5, 2020
Chlorine's datalog ideas
View query.clj
;; What I want to do is something like this:
(def res
(query '[:find ?meta
[?e :editor/contents "p/deferred"]
[?e :editor/ns ""]
[?fqn :repl/fqn ?e]
[?var :repl/var ?fqn]
[?meta :repl/meta ?fqn]]))
View chlorine-config.cljs
(defn- wrap-in-tap [code]
(str "(let [value " code
" rr (try (resolve 'requiring-resolve) (catch Throwable _))]"
" (if-let [rs (try (rr 'cognitect.rebl/submit) (catch Throwable _))]"
" (rs '" code " value)"
" (tap> value))"
" value)"))
(defn tap-top-block []
(p/let [block (editor/get-top-block)]
mauricioszabo / chlorine-config.cljs
Last active Aug 25, 2020
A simple POC on rendering custom test reporters inside Chlorine
View chlorine-config.cljs
(def old-fail-blob
'(defmethod clojure.test/report :fail [m]
(clojure.test/inc-report-counter :fail)
(println "\nFAIL in" (clojure.test/testing-vars-str m))
(when (seq clojure.test/*testing-contexts*) (println (clojure.test/testing-contexts-str)))
(when-let [message (:message m)] (println message))
(println "expected:" (pr-str (:expected m)))
(println " actual:" (pr-str (:actual m))))))