Skip to content

Instantly share code, notes, and snippets.

View euharrison's full-sized avatar
🚲
Bike!

Harrison Mendonça euharrison

🚲
Bike!
View GitHub Profile
@euharrison
euharrison / tryHard.tsx
Created August 25, 2021 19:23
Try hard a request before give up
async function tryHard<T>(fn: () => Promise<T>, attempts = 3): Promise<T> {
try {
return await fn()
} catch (error) {
if (attempts > 0) {
return await tryHard(fn, attempts - 1)
} else {
throw error
}
}
@euharrison
euharrison / list-peer.js
Created February 28, 2018 17:25
List peerDependencies for specific package version and above
const { execSync } = require('child_process');
const packageName = 'react-hot-loader';
const currentVersion = '1.3.0';
const allVersions = eval(execSync(`npm view ${packageName} versions`).toString());
const currentVersionIndex = allVersions.indexOf(currentVersion);
const forwardVersions = allVersions.slice(currentVersionIndex);
forwardVersions.forEach(version => {
#loading {
@extend %screen;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
background: linear-gradient(rgb(255, 211, 0), rgb(239, 78, 35));
font-size: 33px;
color: #fff;
http://constant.co.za/fix-permissions-on-xampp-osx/
@euharrison
euharrison / 01composer.config
Created November 12, 2015 21:55
.ebextensions Laravel
commands:
01-update-composer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root
container_commands:
@euharrison
euharrison / gist:a170a6cd1e221205e523
Last active October 5, 2015 01:54
arrows key to calibrate
var values = [0,0,0,0];
document.addEventListener('keydown', function(e) {
if (!e.ctrlKey && !e.altKey && !e.shiftKey) {
switch (e.which) {
case 38: values[0]++; e.preventDefault(); break; //right
case 39: values[0]++; e.preventDefault(); break; //up
case 37: values[0]--; e.preventDefault(); break; //left
case 40: values[0]--; e.preventDefault(); break; //down
}
}
@euharrison
euharrison / gist:2e25f196dbad16ee8efb
Created August 3, 2015 14:03
font-size calculator
<!doctype html>
</html>
<head>
<title>Calculadora de font-size responsivo</title>
<style type="text/css">
body {
font-family: sans-serif;
max-width: 700px;
margin: 30px auto;