Skip to content

Instantly share code, notes, and snippets.


Rodolfo Ferreira rodolfo42

View GitHub Profile
rodolfo42 /
Last active Apr 20, 2021
Completed JSON

For when you have incomplete JSON strings like:

  {"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 / code.js
Last active Apr 9, 2020
Bookmarklet to organize status checks in bors
View code.js
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); = "flex-basis: 50%; flex-grow: 2; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dashed #666; order: " + order + ";"; = "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 /
Last active Dec 14, 2018 — forked from bltavares/
Resources for learning Clojure
rodolfo42 / watch.clj
Created Aug 29, 2018
watch files for changes and reload namespaces
View watch.clj
(require '[ :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 /
Created Apr 30, 2018
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
rodolfo42 /
Last active Jan 19, 2018
Post current playing Spotify song to a txt online (MacOS)

How to use it

$ curl -s > ~/

Change the URL

Change URL to some url (it's a simple persistent textarea in the cloud)

rodolfo42 / batch-write.js
Created Aug 8, 2017
DynamoDB streams lambda trigger
View batch-write.js
const items = [{
"Username": "First",
"Timestamp": "2017-08-07T19:51:00.794Z",
"Message": "first item in batch"
"Username": "Second",
"Timestamp": "2017-08-07T19:51:00.794Z",
"Message": "second item in batch"
rodolfo42 /
Last active Apr 24, 2017
Example of dependency injection with modules

@team/corelib library


This is a stats lib that has no dependencies but needs to be initialized.

module.exports = function initializeStats(projectName, options) {
  return {
rodolfo42 /
Created Apr 12, 2017
tabs to spaces recursive
mkdir -p exp &&\
ls -1 | grep -v exp | xargs -I '@' cp -aRv @ exp/@ &&\
find * -type f | grep -e '\.\(html\|scss\|css\|js\)$' | grep -ve '^exp' |\
xargs -tn1 -I file bash -c 'expand -t 2 file > exp/file' &&\
cp -avR exp/* . &&\
rm -rf exp
rodolfo42 / diffs.js
Last active Apr 12, 2017
Yield differences in parsing dates from log vs event log timestamp
View diffs.js
const moment = require('moment');
const format1 = require('./format1_log_events.json');
const format2 = require('./format2_log_events.json');
const events = {