Skip to content

Instantly share code, notes, and snippets.

View ruanmartinelli's full-sized avatar
🎯

Ruan Martinelli ruanmartinelli

🎯
View GitHub Profile
This file has been truncated, but you can view the full file.
{
"openapi": "3.0.3",
"info": {
"title": "API Reference",
"version": "v0",
"description": "Sentry Public API",
"termsOfService": "http://sentry.io/terms/",
"contact": {
"email": "partners@sentry.io"
},
import crypto from 'crypto'
const algorithm = 'aes-192-cbc'
const key = crypto.scryptSync('YOUR KEY', 'salt', 24)
export function encrypt(text: string) {
const iv = crypto.randomBytes(16)
const cipher = crypto.createCipheriv(algorithm, key, iv)
const encrypted = cipher.update(text, 'utf8', 'hex')
return [encrypted + cipher.final('hex'), Buffer.from(iv).toString('hex')].join('|')
@ruanmartinelli
ruanmartinelli / node-modules-cleanup.sh
Created April 27, 2021 14:17
Clean up your `node_modules` folder to free up space 🧹
# MacOS only!
# Go to parent folder
cd /my/folder/
# List the total size of all node_modules folders
find . -name "node_modules" -type d -prune -print | xargs du -chs
# Delete all node_modules folder (danger! irreversible)
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
@ruanmartinelli
ruanmartinelli / sentence-length-bookmarklet.js
Created November 27, 2020 10:59
sentence-length-bookmarklet
javascript:(function()%7Bvar%20colors%20%3D%20%5B'%23faf5cb'%2C%20'%23fcd2fa'%2C%20'%23c7f4c9'%2C%20'%23a7f3f1'%5D%3B%5B%5D.slice.apply(document.querySelectorAll('p%2C%20dt%2C%20dd%2Cli')).forEach(function(n)%7Bvar%20s%20%3D%20n.innerHTML.split('.%20')%3Bs.forEach(function(s)%7Bvar%20words%20%3D%20s.split('%20')%2Clength%20%3D%20words.length%3B%7D)%3Bvar%20r%20%3D%20''%3Bs.map(function(s)%7Bvar%20l%20%3D%20s.split(%22%20%22).length%2C%20c%3Bswitch(l)%7Bcase%201%3Acase%202%3Ac%20%3D%20colors%5B0%5D%3Bbreak%3Bcase%203%3Acase%204%3Acase%205%3Acase%206%3Ac%20%3D%20colors%5B1%5D%3Bbreak%3Bcase%207%3Acase%208%3Acase%209%3Acase%2010%3Acase%2011%3Acase%2012%3Ac%20%3D%20colors%5B2%5D%3Bbreak%3Bdefault%3Ac%20%3D%20colors%5B3%5D%3Bbreak%3B%7Dr%20%2B%3D%20'%3Cspan%20style%3D%22background-color%3A'%20%2B%20c%20%2B%20'%22%3E'%20%2B%20s%20%2B%20'.%20%3C%2Fspan%3E'%3B%7D)%3Bn.innerHTML%20%3D%20r%3B%7D)%7D)()
create or replace function jsonb_merge_deep(jsonb,jsonb)
returns jsonb
language sql
immutable
as $func$
select case jsonb_typeof($1)
when 'object' then case jsonb_typeof($2)
when 'object' then (
select jsonb_object_agg(k, case
when e2.v is null then e1.v

Keybase proof

I hereby claim:

  • I am ruanmartinelli on github.
  • I am ruanmartinelli (https://keybase.io/ruanmartinelli) on keybase.
  • I have a public key ASCPdburJB20NwngQA4UOlY3QWabh4w905BgvIZ5io5eKAo

To claim this, I am signing this object:

#!/usr/bin/env bash
RES_PATH=/usr/lib/slack/resources/app.asar.unpacked/src/static
BLUE_DOT_ICON=slack-taskbar-unread.png
DEFAULT_ICON=slack-taskbar-rest.png
cd $RES_PATH && {
mv $BLUE_DOT_ICON old-blue-dot-icon.png
cp $DEFAULT_ICON $BLUE_DOT_ICON
[/]
move-to-workspace-left=['<Control><Alt>Left']
switch-to-workspace-left=['<Alt>Left']
begin-move=['<Alt>F7']
maximize-horizontally=['disabled']
switch-to-workspace-10=['disabled']
switch-to-workspace-11=['disabled']
switch-to-workspace-12=['disabled']
switch-to-workspace-1=['<Super>Home']
switch-to-workspace-2=['disabled']
{
"oid": 100,
"key": "17acf4e81bf5485baabf0434b811153b",
"name": "Temperature",
"sensor": {
"oid": 77,
"key": "625250e4552546349996a16eee943b57",
"name": "Doctor_s Office ",
"description": "Doctor_s Office ",
"owner": {

A Evolução do JavaScript Assíncrono

  • Duração: 30 - 35min
  • Nível: Iniciante
  • Keywords: JavaScript, Programação Assíncrona

Resumo

A rápida evolução do JavaScript nos últimos anos trouxe consigo uma série de novos padrões para lidar com operações assíncronas.