This file contains 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
function validAnagram(first, second) { | |
if (first.length !== second.length) { | |
return false; | |
} | |
const lookup = {}; | |
for (let i = 0; i < first.length; i++) { | |
let letter = first[i]; | |
// if letter exists, increment, otherwise set to 1 |
This file contains 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
function same(arr1, arr2){ | |
if(arr1.length !== arr2.length){ | |
return false; | |
} | |
for(let i = 0; i < arr1.length; i++){ | |
let correctIndex = arr2.indexOf(arr1[i] ** 2) | |
if(correctIndex === -1) { | |
return false; | |
} | |
console.log(arr2); |
This file contains 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
// Example of a Private Route | |
import React from 'React' | |
import { Route as ReactDOMROute, RouteProps, Redirect } from 'react-router-dom' | |
import { useAuth } from 'useAuth' | |
function Route({ isPrivate: false, component: Component, ...rest }) { | |
const { user } = useAuth(); | |
return ( |
This file contains 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": "Min Dark", | |
// // "editor.lineHeight": 24, | |
// "editor.fontWeight": "400", | |
// "editor.fontFamily": "Fira Code", | |
// "editor.fontLigatures": true, | |
// // Aplica linhas verticais para lembrar de quebrar linha em códigos muito grandes | |
// "editor.rulers": [ | |
// 100 |
This file contains 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
module.exports = { | |
env: { | |
browser: true, | |
es6: true, | |
jest: true, | |
}, | |
extends: [ | |
'react-app', | |
'airbnb', | |
'plugin:@typescript-eslint/recommended', |
This file contains 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
// { | |
// "eslint.codeActionsOnSave": true, | |
// "eslint.validade": [ | |
// "javascript", | |
// "javascriptreact", | |
// {"language": "typescript", "autoFix": true}, | |
// {"language": "typescriptreact", "autoFix": true} | |
// ] | |
// } |
This file contains 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
CREATE ROLE uni WITH LOGIN PASSWORD 'password'; | |
psql -d postgres -U uni | |
\c uni_ru; | |
\dt mostra tds | |
brew services start postgresql | |
brew services stop postgresql |
This file contains 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 <stdio.h> | |
#include <string.h> | |
// Definindo um struct para cartas de um baralho | |
struct carta { | |
char nome[101]; | |
char valor[101]; | |
int poder; | |
}; | |
typedef struct carta carta;; |
This file contains 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
function change_machine(cents) { | |
// quarters (25 cents) | |
// dimes (10 cents) | |
// nickels (05 cents) | |
// pennies (01 cent) | |
// you shall remove the ifs, they are totally unnecessary | |
let quarters = 0, dimes = 0, nickels = 0, pennies = 0; | |
if(cents >= 25) { |
This file contains 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 <stdio.h> | |
int main(void) | |
{ | |
printf("hello world!"); | |
return 0; | |
} | |
// compiler file_name -o created_file_name |
NewerOlder