Skip to content

Instantly share code, notes, and snippets.

View rodolfo42's full-sized avatar
🎧

Rodolfo Ferreira rodolfo42

🎧
View GitHub Profile
@rodolfo42
rodolfo42 / okta.csv
Created July 19, 2023 17:19
Import users into Lightdash from Okta CSV dump (Clojure)
user.id user.firstName user.lastName user.email user.status
00u5vogndju36975tn First Last email@example.com ACTIVE
@rodolfo42
rodolfo42 / date_dimension.sql
Created May 24, 2023 15:07
Date dimension table Postgres (with Portuguese locale)
set lc_time to 'pt_BR.utf8';
select TO_CHAR(DATE(NOW()), 'TMDay');
-- Quarta
CREATE TABLE dim_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
@rodolfo42
rodolfo42 / data.clj
Created May 19, 2023 17:30
Pull datomic data by namespace with tx-time
(ns data
(:require [datomic.client.api :as datomic]))
(def client
(datomic/client {:db-name ""
:system ""
:server-type :cloud
:region ""
:endpoint ""}))
@rodolfo42
rodolfo42 / deps.edn
Last active July 13, 2022 19:30
Generate EQL query from sample data (with Pathom)
{:deps {com.wsscode/pathom3 {:mvn/version "2022.07.08-alpha"}}}
@rodolfo42
rodolfo42 / crux_zoned_date_time.clj
Last active May 20, 2021 22:56
Crux & ZonedDateTime (vs. java.util.Date, LocalDate, LocalDateTime)
(ns crux-zoned-date-time
(:require [crux.api :as crux]
[clojure.pprint :refer [pprint]])
(:import [java.util UUID Date]
[java.time LocalDateTime ZonedDateTime LocalDate Instant]))
(def sample-n 10)
(defonce node
(crux/start-node {}))
@rodolfo42
rodolfo42 / README.md
Last active April 20, 2021 02:00
Completed JSON

For when you have incomplete JSON strings like:

{"Fault":
  {"faultcode": "StartTransmissionFail",
   "faultstring": {"content": "Internal Error"

Given an incomplete JSON-encoded string, attempts to complete it with the missing ", } and ] characters necessary for it to be valid.

@rodolfo42
rodolfo42 / code.js
Last active April 9, 2020 02:42
Bookmarklet to organize status checks in bors
function appendRow(el, test, status, link) {
var testName = document.createElement("div");
var statusCell = document.createElement("div");
statusCell.innerText = status;
var order = (status == "Succeeded" ? 10 : 5);
testName.style = "flex-basis: 50%; flex-grow: 2; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dashed #666; order: " + order + ";";
statusCell.style = "flex-grow: 1; text-align: right; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dashed #666; order: " + order + ";";
if (link) {
var a = document.createElement("a");
a.innerText = test;
@rodolfo42
rodolfo42 / README.md
Last active February 28, 2023 17:39 — forked from bltavares/README.md
Resources for learning Clojure
@rodolfo42
rodolfo42 / watch.clj
Created August 29, 2018 14:27
watch files for changes and reload namespaces
(require '[io.pedestal.service-tools.dev :as dev-tools])
(def ^:private watcher (atom nil))
(defn stop-watching []
(let [stop @watcher]
(when (fn? stop) (stop) (reset! watcher nil))))
(defn watch
([] (watch ["src/"]))
@rodolfo42
rodolfo42 / README.md
Created April 30, 2018 09:47
Fix for "symbol cannot be resolved" for Cursive + Midje

Fix for 'symbol cannot be resolved' when using Cursive + midje

Midje checkers (e.g. n-of, has, match from matcher-combinators) cannot be resolved when using Cursive because they are declared using the defchecker macro.

To make Cursive able to resolve these references as valid symbols, follow these steps:

  1. Download the defchecker.xml file somewhere in your machine
  2. In Cursive (IntelliJ) Preferences pane, navigate to Languages & Frameworks > Clojure > Symbol Resolution
  3. Click the cog icon, select Import Scheme... and choose the file you downloaded.
  4. Click Apply. Note: all open projects will be refreshed and re-indexed, so go get a coffee ☕