This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function retry<T>(fn: () => Promise<T>, retries: number = 5) { | |
try { | |
return await retry() | |
} catch (err) { | |
if (retries > 0) { | |
console.log("Retrying...") | |
return await retry(fn, retries - 1) | |
} | |
throw err | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Class<T = unknown> = new (...args: unknown[]) => T | |
class DependencyManager { | |
// eslint-disable-next-line no-use-before-define | |
private static instance: DependencyManager | |
public deps: Record<string, Class> = {} | |
private constructor() {} | |
public static getInstance(): DependencyManager { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function random(length) { | |
let text = ''; | |
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
for (let i = 0; i < length; i += 1) { | |
text += possible.charAt(Math.floor(Math.random() * possible.length)); | |
} | |
return text; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Define o tema do VSCode | |
"workbench.colorTheme": "Atom One Dark", | |
// Aumenta a fonte do terminal | |
"terminal.integrated.fontSize": 14, | |
// Define o tema dos ícones na sidebar | |
"workbench.iconTheme": "material-icon-theme", | |
"workbench.startupEditor": "newUntitledFile", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Dimensions } from 'react-native'; | |
const widthPercentageToDP = widthPercent => { | |
const screenWidth = Dimensions.get('window').width; | |
const elemWidth = parseFloat(widthPercent); | |
return PixelRatio.roundToNearestPixel((screenWidth * elemWidth) / 100); | |
}; | |
const heightPercentageToDP = heightPercent => { | |
const screenHeight = Dimensions.get('window').height; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class PlayerBehaviourScript : MonoBehaviour { | |
private float x; | |
private float y; | |
private float z; | |
public bool canJump = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
bool is_palindrom(int number); | |
int main() { | |
int number; | |
le (number > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR=~/ | |
FILE_PROFILE=.profile | |
FILE_BASH=.zshrc | |
DOWNLOADS=Downloads | |
cd ~/Downloads/ | |
wget -c --tries=3 -O ${$DIR$DOWNLOADS}"/jdk.tar.gz http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz?AuthParam=1522841007_f9dd76d4f638494498691469a78af142 | |
tar -xvf ${$DIR$DOWNLOADS}/jdk.tar.gz |