Skip to content

Instantly share code, notes, and snippets.

View luisvinicius09's full-sized avatar
๐Ÿš€

Luis Vinicius luisvinicius09

๐Ÿš€
View GitHub Profile
@luisvinicius09
luisvinicius09 / leibnizPi.c
Last active April 13, 2022 21:21
leibnizPi-C
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
int i, c;
double pi, x, dn;
dn = 1.00;
pi = 4.00;
@luisvinicius09
luisvinicius09 / activeItem.js
Created July 4, 2021 02:40
Active item on list
const list = document.querySelectorAll('.list');
for (let i = 0; i < list.length; i += 1) {
list[i].onclick = () => {
let j = 0;
while (j < list.length) {
list[j++].className = '.list';
}
list[i].className = '.list active';
}
@luisvinicius09
luisvinicius09 / projectCreation.js
Created April 7, 2021 18:40
This is a snippet for creating 'projects' and storing it in on localStorage.
const projectBtn = document.querySelector('#project-btn');
const projectName = document.querySelector('#new-project');
window.addEventListener('load', () => {
if(JSON.parse(localStorage.getItem('projects')) === null) {
localStorage.setItem('projects', JSON.stringify(new Array));
}
displayProjects();
require_relative 'enumerables'
=begin test variables
array_test = [1, 2, 3, 4, 5, 6]
obj_test = { one: 1, two: 2, three: 3 }
# Method call for tests each
puts '------------Original each--------------'
array_test.each { |e| p e**2 }
obj_test.each { |e| p e }
@luisvinicius09
luisvinicius09 / gist:6df8517df6a2e01ced166d118f0de289
Created December 17, 2020 16:40
Address autocomplete for Brazil
This is a code for autocomplete the address in forms using ViaCEP endpoint.
<script>
function clean_forms() {
document.getElementById('street').value = ('');
document.getElementById('district').value = ('');
document.getElementById('city').value = ('');
document.getElementById('uf').value = ('');
}
function my_cb(content) {