Skip to content

Instantly share code, notes, and snippets.

View vinpac's full-sized avatar
🤗
Ready

Vinicius Pacheco vinpac

🤗
Ready
View GitHub Profile
<script>
let lista = [
'Pao',
'Leite',
'Carne',
]
let novoItem = ''
const adicionarItemALista = () => {
// lista.push Adiciona, but nao atualiza a lista. Entao o svelte nao entende que a lista mudou
@vinpac
vinpac / example.svelte
Created March 4, 2022 12:31
Login in Svelte
<script>
// Aqui usamos const porque os valores CERTOS nao mudam
const emailCerto = "fabio@fabio"
const senhaCerta = "fabio123"
// Aqui usamos let porque os valores que a pessoa ESTA ESCREVENDO vao mudar
let email = ''
let senha = ''
// Aqui estamos guardando o estado do nosso formulario
@vinpac
vinpac / aula-01.js
Created October 26, 2021 22:56
Aulas
// 1. Criar uma função acha o maior numero numa lista
// 2. Criar uma função acha o menor numero numa lista
// 3. Criar uma função que acha o primeiro numero duplicado numa lista
function passo() {
// ...
}
function caminhada(inicio, destino) {
// dar a caminhada
@vinpac
vinpac / loadtest.js
Created February 18, 2021 16:41
Load test with GraphQL
import http from 'k6/http'
import { check, sleep, group } from 'k6'
import { Trend } from 'k6/metrics'
let FeedTrend = new Trend('Get feed', true)
let CreateUserTrend = new Trend('Create user', true)
let CreatePostTrend = new Trend('Create post', true)
let CreateCommentTrend = new Trend('Create comment', true)
let CreateLikeTrend = new Trend('Create like', true)
@vinpac
vinpac / first-duplicate.js
Created November 25, 2019 19:18
Atados - First duplicate array test
// Atados Test - First duplicate
//
// Given an array a that contains only numbers in the range from 1 to a.length,
// find the first duplicate number for which the second occurrence has the minimal index.
// In other words, if there are more than 1 duplicated numbers, return the number for which
// the second occurrence has a smaller index than the second occurrence of the other number does.
// If there are no such elements, return -1.
//
// Example
//
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDtQQhARneTTjFSdtCGgtaiGCry32gLIqHkbCVTG0ZpvFgkkNoGpwZhgV/e0GVpj8xzeGzbyUIJesRB/t7Ldi7VKHUK4IMcXmngZ8snnnN0VZgsbKFk13/QEL8eu4A/FfNnefJ0dEP5SSyBvW6T9Sunp8s+JMX6L/TkHG+r18ITrgdaQcYjPSsqLJLSqTAsmv+JAetumb7h1+2xYBPR5Sn5R8JX7IAfpW81uZ4KMXKm8+3MLF9+KIGC+yxp4G9a/VmmAObcnsZqAGPnqIgR6SVo984MjAyHfHe7yJvdIqFFjqCl0U3qlGJ2pBn7CY44G6szMfU3O5sobZFcoiSaUwLZTrn1ZrG1smXWn02TYZe0nm1RUS72XMCCF27DYaIx9NV6EsOjX4hyQ6i4eqLdq0axgL3Oy9SDkVq5zj9X+tw2KfHdF7G2n5PMvbb3KoM7yw1SIKS+DGE5kfRdUyAfrTSSNexpzRVFEcw2jZl/SFQqgqyyMplacfe/6/Y1NiS5wUEEARiaC3KUKadXYN8VjiSeATprGc8jZ5+2R95KZ8s/Szyh8hGNPKeK88FwlDhLCyGt+nn0ZGXj429foMSvU5/4MnzEadaHy4yqAR78tJat9PS+rAF9p0s3xWTSZ+PoBrgO8g3jRXHP04FQ0brfok/6mSorwNoqXlbcqN1QOznPwQ== murdock@MacBook-Pro
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC//Ojb3qTgKkpSBnvABxvj1G8WNo2EzhyxdQ8xGd6Z6j9FMUfOp46Kmz4CadiOPJf7X4CL/8UBRDr8CrlIqmcm4TX3Fi2DKJmGtO7ZZBf8m+9P23Jb9x/6qDx91qUHuWJaFUeSHrYJWWfa7RpXXyKPmWlifBefFWHvU06dPto15t9/gMX8TAagli+BEDMvoZ59CG6+OKwlOS0kl2FprXnnY+dRefng6trDSgoE9nUvKdMR+NcuK6QUtoa7kSAvdIkkDkKKstProDSBSmbPap9cCUntdAW1SOrVBX5PEq1LWN9I+d0L4e1I9ViS6GnrhsxPW4nIGqDzy3rIBQQCTmdz fabio@fabio-Inspiron-5458
@vinpac
vinpac / .java
Created January 20, 2017 01:28
Realm example
class User {
@PrimaryKey
private String id;
private String name;
private String avatar; // url do avatar
}
User user = new User("id", "Geovani", "https://68.media.tumblr.com/60c074d952ce220d58da51f9f99c4a58/tumblr_ojxrmvaMhN1qz7t0xo1_540.jpg");
Realm.init(context);
<?php
$directory_iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/Applications/MAMP/htdocs/', RecursiveDirectoryIterator::SKIP_DOTS));
foreach($directory_iterator as $filename => $file)
{
if ($file->getExtension() !== "html" ) {
continue;
}