Skip to content

Instantly share code, notes, and snippets.

View emersxw's full-sized avatar
😎
oh, hey!

Emerson Lopes emersxw

😎
oh, hey!
View GitHub Profile
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
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);
// 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 (
{
// // 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
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
},
extends: [
'react-app',
'airbnb',
'plugin:@typescript-eslint/recommended',
// {
// "eslint.codeActionsOnSave": true,
// "eslint.validade": [
// "javascript",
// "javascriptreact",
// {"language": "typescript", "autoFix": true},
// {"language": "typescriptreact", "autoFix": true}
// ]
// }
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
@emersxw
emersxw / struct.c
Created May 15, 2019 20:59
A simple struct with char in c
#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;;
@emersxw
emersxw / cents.js
Created March 2, 2019 01:14
cents into
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) {
#include <stdio.h>
int main(void)
{
printf("hello world!");
return 0;
}
// compiler file_name -o created_file_name