Skip to content

Instantly share code, notes, and snippets.

View ccarvalho-eng's full-sized avatar
🏰
Working from home

Cristiano Carvalho ccarvalho-eng

🏰
Working from home
View GitHub Profile
```sql
SELECT
json_agg(
json_build_object(
'first_name', u.first_name,
'last_name', u.last_name,
'email', u.email
)
) FROM users AS u
```
```python
class Journal:
def __init__(self, date):
self.date = date
class Meeting(Journal):
def __init__(self, date, time):
super().__init__(date)
self.time = time
1. Fold / Unfold
1. z c → fold
2. z o → unfold
3. z r → open recursively
2. Find + Replace
1. S s p
2. C c + C e
3. :%s/<WORD>/<UPDATED WORD>
4. C c + C c
3. Minimap
α - Α → alpha
β - Β → beta
γ - Γ → gamma
δ - Δ → delta
ε - Ε → epsilon
ζ - Ζ → zeta
η - Η → eta
θ - Θ → theta
ι - Ι → iota
κ - Κ → kappa
Print file names
```
for f in *.jpg; do echo ${f}; done;
```erlang
-module(fact).
% fact module
-export([run/1]).
-spec run(integer()) -> integer().
run(N) when N > 0 ->
N * run(N-1);
@ccarvalho-eng
ccarvalho-eng / doom.txt
Created February 1, 2023 02:12 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
-module(all_atoms).
-export([all_atoms/0]).
atom_by_number(N) ->
binary_to_term(<<131,75,N:24>>).
all_atoms() ->
atoms_starting_at(0).
{
"title": "Erlang Atoms",
"description": "",
"visuals": [
{
"title": "Atom usage",
"description": "Usage of atoms in Erlang and the configured limit.",
"line_label": "%name% %hostname%-%type%",
"display": "LINE",
"format": "number",
@ccarvalho-eng
ccarvalho-eng / 01_scripts_and_styles.js
Created March 12, 2023 14:53 — forked from sesgoe/01_scripts_and_styles.js
Retool Realtime WebSocket
const webSocket = new WebSocket('wss://echo.websocket.org');
//Event listeners are the pillars upon which WebSockets are built. This event fires when the WebSocket is considered 'OPEN',
//which means that it has connected successfully.
webSocket.addEventListener('open', function(event) {
console.log('websocket connected successfully') //log this into the browser console so we can check if the websocket connected
});
//This is a global reference to the websocket that we created. We need this because otherwise multiple JS