Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
miguelbermudez / README.md
Created June 14, 2023 15:14 — forked from goliatone/README.md
Postgres TRIGGER to call NOTIFY with a JSON payload

This TRIGGER function calls PosgreSQL's NOTIFY command with a JSON payload. You can listen for these calls and then send the JSON payload to a message queue (like AMQP/RabbitMQ) or trigger other actions.

Create the trigger with notify_trigger.sql.

When declaring the trigger, supply the column names you want the JSON payload to contain as arguments to the function (see create_triggers.sql)

The payload returns a JSON object:

@miguelbermudez
miguelbermudez / .gitconfig
Last active September 9, 2022 00:50
my aliases from .gitconfig
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lgb = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lgf = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
log1 = log --pretty=oneline --abbrev-commit --decorate
log = log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate
ll = log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat
lds = log --pretty=format:\"%C(yellow)%h\\\\ %ad%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --date=short
tree = log --all --graph --decorate=short --color --format=format:'%C(bold blue)%h%C(reset) %C(auto)%d%C(reset)%x09%$
@miguelbermudez
miguelbermudez / deps.edn
Created July 18, 2019 06:22 — forked from jmingtan/deps.edn
Clojure CLI setup with rebel-readline and cider middleware
{:aliases
{:dev {:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.2"}
org.clojure/tools.nrepl {:mvn/version "0.2.12"}
cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"}}
:main-opts ["-m" "repl"]}}}
@miguelbermudez
miguelbermudez / redux-ish.clj
Created December 3, 2017 01:09 — forked from nhusher/redux-ish.clj
Redux with basically no effort in clojurescript, plus core.async to handle asynchronous actions
(ns reduxish.state-tools
(:require-macros [cljs.core.async.macros :refer [go go-loop]])
(:require [cljs.core.async.impl.protocols :refer [WritePort ReadPort]]
[cljs.core.async :refer [<!]]))
(defn channel?
"A predicate that determines if the provided thing is a core.async channel"
[ch]
(and (satisfies? WritePort ch) (satisfies? ReadPort ch)))
@miguelbermudez
miguelbermudez / snippets.js
Created October 16, 2017 15:04
Devtools Snippets
# add lodash
var el = document.createElement('script');
el.src = "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js";
el.type = "text/javascript";
document.head.appendChild(el);
@miguelbermudez
miguelbermudez / 00_destructuring.md
Created August 29, 2017 02:49 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors

@miguelbermudez
miguelbermudez / win10-dev.md
Created June 3, 2017 05:18 — forked from wsargent/win10-dev.md
Windows Development Environment for Scala

Windows 10 Development Environment for Scala

This is a guide for Scala and Java development on Windows, using Windows Subsystem for Linux, although a bunch of it is applicable to a VirtualBox / Vagrant / Docker subsystem environment. This is not complete, but is intended to be as step by step as possible.

Sadly, much of this pertains to Git, GPG, SSH, and Windows all not working, rather than Windows Subsystem for Linux. There is no unified command line experience for native Windows still -- instead, there's a bunch of different conflicting programs which all bring along their own environment and need to be told about each other.

Harden Windows 10

Read the entire Decent Security guide, and follow the instructions, especially:

@miguelbermudez
miguelbermudez / input.json
Created April 6, 2017 15:48
What does the schema look like for this?
{
"highlighting": {
"17235597841101694696884915866769312987": {
"ttl_suggest": [
"<em>foo</em> bar"
]
},
"249465359476890333636353620182635563595": {
"ttl_suggest": [
"scc of <em>foo</em>"
@miguelbermudez
miguelbermudez / better-diff
Last active March 20, 2017 05:46
Git Aliases for logging
# https://github.com/so-fancy/diff-so-fancy #
[core]
pager = diff-so-fancy | less --tabs=4 -RFX
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
@miguelbermudez
miguelbermudez / Makefile
Created December 16, 2016 22:26 — forked from rauhs/Makefile
Compiling clojurescript + figwheel without boot nor leiningen. Using leiningen to manage dependencies. Print file size stats (raw, gzip, brotli) for production builds
CLJ_NREPL_PORT:=22340
FIGWHEEL_PORT:=22345
CLJS_JAR_VERSION:=1.7.48
CLJS_JAR_URL:=https://github.com/clojure/clojurescript/releases/download/r$(CLJS_JAR_VERSION)/cljs.jar
.PHONY: def_target
def_target : null