Skip to content

Instantly share code, notes, and snippets.

View fmoliveira's full-sized avatar

Filipe Oliveira fmoliveira

  • Level Access
  • Toronto
  • 21:37 (UTC -04:00)
View GitHub Profile
@fmoliveira
fmoliveira / Readme.md
Created June 28, 2020 01:18 — forked from colllin/Readme.md
Auth0 + FaunaDB integration strategy

Goal

Solutions

At the very least, we need two pieces of functionality:

  1. Create a user document in Fauna to represent each Auth0 user.
  2. Exchange an Auth0 JWT for a FaunaDB user secret.
@fmoliveira
fmoliveira / fetch-timeout.js
Created June 24, 2020 19:07 — forked from davej/fetch-timeout.js
Add a pseudo timeout/deadline to a request using the ES6 fetch api
Promise.race([
fetch('/foo'),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Timeout')), 7000)
)
]);
@fmoliveira
fmoliveira / VS Code Extensions.md
Last active June 12, 2020 09:35
Extensive Research on VS Code Marketplace for extensions that can make us more productive
  • Researched on 05/20/2020
    • Total Extensions Seen
      • Featured: 12
      • Trending: 36
      • Most Popular: 1026
      • Total: 1074 extensions seen manually on the VS Code Marketplace
    • Pre-selected
      • 83 extensions + some themes and a few icon sets
      • Complete list removed from this file for brevity
  • Triaged
@fmoliveira
fmoliveira / README.md
Last active June 12, 2020 05:16 — forked from onomatopellan/wsl.conf
/etc/wsl.conf Avoid adding Windows Path to Linux $PATH

Right now access to /mnt folders in WSL2 is too slow and by default at launch the entire Windows PATH is added to the Linux $PATH so any Linux binary that scans $PATH will make things unbearably slow. #5159

The best for now is using appendWindowsPath=false and adding folders to the $PATH manually. For example for VSCode you only need: export PATH=$PATH:"/mnt/c/Users/onoma/AppData/Local/Programs/Microsoft VS Code/bin" replacing onoma with your Windows username.

Source: microsoft/WSL#4498 (comment)

@fmoliveira
fmoliveira / AutoFocusStory.tsx
Created May 28, 2020 19:25
Storybook Decorator for Auto Focus
import React, { useCallback } from 'react';
/**
* Storybook Decorator
*
* Auto click the first focusable element.
*/
const AutoFocusStory = (storyFn: () => {} | null | undefined) => {
const autofocus = useCallback((node: HTMLDivElement) => {
const element = node.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
@fmoliveira
fmoliveira / slack-macro.js
Created December 18, 2019 18:26
Slack macro to quickly delete messages, activate this script and click on the messages you want to be deleted
document.addEventListener("click", event => {
const [element] = event.path;
console.warn({ element });
// click on more actions menu, which is only visible when you hover a message
if (
element.classList.contains("c-message__body") ||
element.classList.contains("c-message__content_header") ||
element.classList.contains("c-file_gallery") ||
@fmoliveira
fmoliveira / webscraping_nyc_mta.py
Created October 30, 2019 10:34 — forked from julia-git/webscraping_nyc_mta.py
webscraping_nyc_mta
# Import libraries
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
# Set the URL you want to webscrape from
url = 'http://web.mta.info/developers/turnstile.html'
# Connect to the URL
@fmoliveira
fmoliveira / Container.js
Created October 18, 2019 18:40
styled-components media queries
/*
* source: https://react-brasil.slack.com/archives/C1EDVPBQC/p1571423188462000?thread_ts=1571421080.458800&cid=C1EDVPBQC
* author: João Paulo Siqueira Lins
*/
import styled from "styled-components"
import MediaPoint from "./MediaPoint"
const Container = styled.div`
@fmoliveira
fmoliveira / ErrorBoundaryWithRetry.tsx
Created September 20, 2019 13:05 — forked from sibelius/ErrorBoundaryWithRetry.tsx
ErrorBoundaryWithRetry to be used with relay useQuery hook
class ErrorBoundaryWithRetry extends React.Component<Props, State> {
state = {error: null};
static getDerivedStateFromError(error): State {
return {error: error};
}
_retry = () => {
this.setState({error: null});
}
@fmoliveira
fmoliveira / .zshrc
Created October 2, 2018 18:42
My Shell Helper Functions
whoport() {
lsof -nP -i4TCP:$@ | grep LISTEN
}