Skip to content

Instantly share code, notes, and snippets.

View smachs's full-sized avatar
:electron:

Gabriel Correa smachs

:electron:
View GitHub Profile
@smachs
smachs / fetch-rest-api.js
Created September 23, 2020 12:29 — forked from samikeijonen/fetch-rest-api.js
Using Fetch API and REST API
/*
* Load contacts and filter by categories.
*/
( function() {
'use strict';
// Variables.
const filterForm = document.getElementById( 'filter-contacts' );
const contactWrapper = document.getElementById( 'contact-section' );
const htmlOutput = document.getElementById( 'js-contact-replace' );
@smachs
smachs / simple-pagination.js
Created September 22, 2020 15:28 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@smachs
smachs / select-estados-br
Created December 21, 2018 18:13 — forked from cassiocardoso/select-estados-br
Select com uma lista de todos os estados brasileiros.
<select name="estados-brasil">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espírito Santo</option>
<option value="GO">Goiás</option>