Skip to content

Instantly share code, notes, and snippets.

View fmoliveira's full-sized avatar

Filipe Oliveira fmoliveira

  • Level Access
  • Toronto
  • 11:07 (UTC -04:00)
View GitHub Profile
@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 / 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 / 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 / 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 / webpack4upgrade.md
Created June 2, 2018 00:28 — forked from gricard/webpack4upgrade.md
Just some notes about my attempt to upgrade to webpack 4

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
added 1 package, removed 20 packages and updated 4 packages in 13.081s
@fmoliveira
fmoliveira / aoe2hd.md
Created May 30, 2018 17:32 — forked from yocontra/aoe2hd.md
Age of Empires II HD - For Mac OSX
@fmoliveira
fmoliveira / Ruby ORMs.md
Created March 10, 2018 19:14 — forked from booch/Ruby ORMs.md
Ruby ORMs

Ruby ORMs

Abstract

Rails is really a collection of pieces that can be put together to create a web app. You can enhance or replace many of the components - how you write views, how controllers work, and how you build models. While models are built on top of ActiveRecord in the

@fmoliveira
fmoliveira / frontendDevlopmentBookmarks.md
Created October 13, 2017 16:45 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@fmoliveira
fmoliveira / analytics.js
Created August 5, 2017 16:34 — forked from anaisbetts/analytics.js
Google Analytics in Atom Shell
// Pretend that cookies work
(function (document) {
var cookies = {};
document.__defineGetter__('cookie', function () {
var output = [];
for (var cookieName in cookies) {
output.push(cookieName + "=" + cookies[cookieName]);
}
return output.join(";");
});
@fmoliveira
fmoliveira / lazy-img.jsx
Created April 27, 2017 14:00 — forked from fdaciuk/lazy-img.jsx
React Lazy img load component
'use strict';
import React, { PropTypes, Component } from 'react';
class LazyImg extends Component {
constructor () {
super();
this.state = { loaded: false }
this.handleLoad = () => {