Skip to content

Instantly share code, notes, and snippets.

View vvgomes's full-sized avatar
🦖

Vini Gomes vvgomes

🦖
View GitHub Profile
(ns foobar
(:require [clojure.test :refer [deftest is testing]]))
(defn init-count [hm k]
(assoc hm k 0))
(defn inc-count [hm k]
(update-in hm [k] inc))
(defn find-dup [coll]

Quote

Clarity, even when difficult, is a form of respect. You cannot live indefinitely on the strength of what you once were. Nor can you compel belief through repetition alone. At some point, the story must either find new truth, or come to a dignified close.

From an anonymous company review on Glassdoor.

#!/usr/bin/env nu
# In macOS I use Homebrew package manager to install programs.
# Sometimes, I forget the name of a program I've installed recently.
# This Nushell function lists them in reverse instalation date-time order.
def brew-recent [] {
brew info --json=v2 --installed
| from json
| get formulae
/*
* Matrix Transpose
*
* As a Ramda user, I'm aware the library already has a `transpose` function.
* Still, I believe it is a fun exercise.
*
*/
const { all, isEmpty, map, head, tail, concat } = require("ramda");
(ns transpose
(:require [clojure.test :refer :all]))
;; Matrix Transpose
;;
;; If you Google the solution, you'll find this:
;;
;; ```clojure
;; (def transpose
;; (partial apply map vector))
;; The goal of this program is to draw a pyramid in the terminal with a given height.
;;
;; Examples:
;;
;; ↓ height = 1
;;
;; ∆
;;
;; ↓ height = 2
;;
/*
A toy implementation of the Resequencer pattern from Enterprise Integration Patterns.
https://www.enterpriseintegrationpatterns.com/patterns/messaging/Resequencer.html
*/
const createResequencer = (destination) => {
const buffer = {};
let next = 1;
/*
The goal of this exercise is to render an org chart
in your terminal output based on a list of manager-
employee relationships.
Given the following relationships:
[
{ managerId: 1, employeeId: 2 },
(function sayHello(count = 50) {
if (count === 0) return;
console.log("hello world");
sayHello(count - 1);
})();
const ROMAN_VALUES = {
I: 1,
V: 5,
X: 10,
L: 50,
C: 100,
D: 500,
M: 1000
};