Skip to content

Instantly share code, notes, and snippets.

View guiseek's full-sized avatar
🌱
Nós poderíamos ser muito melhores se não quiséssemos ser tão bons.

Guilherme Siquinelli guiseek

🌱
Nós poderíamos ser muito melhores se não quiséssemos ser tão bons.
View GitHub Profile
const id = 'gumga-filter';
let elm = document.querySelector('#' + id);
document.addEventListener('click', (e) => {
let isElement = 0;
angular.forEach(e.path, (node) => {
if (node.nodeName == id.toUpperCase()) isElement++
});
if (!isElement) {
if (!isValidQuery()) {
elm.classList.add('shake');
@guiseek
guiseek / index.html
Last active January 26, 2016 23:35
Loja de Cerveja Index Base
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Loja de Cerveja</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
@guiseek
guiseek / index.html
Last active January 28, 2016 21:46
Loja de Cerveja Template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Loja de Cerveja</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<style>
@guiseek
guiseek / index.html
Last active January 29, 2016 01:56
Loja de Cerveja View com AngularJS
<!DOCTYPE html>
<html ng-app="lojaDeCerveja">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Loja de Cerveja</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<style>
@guiseek
guiseek / loja-de-cerveja.controller.js
Last active January 29, 2016 01:55
Loja de Cerveja Controller com AngularJS
var app = angular.module('lojaDeCerveja', []);
app.controller('LojaDeCervejaController', function($scope) {
// Definindo a lista de cervejarias default
$scope.cervejarias = [
{
id: 1,
nome: 'Araucária'
},
{
<gumga-filter search="searchFilter()" data="teste">
<advanced-search-field type="string" label="Nome" field="nome"></advanced-search-field>
<advanced-search-field type="number" label="Idade" field="idade"></advanced-search-field>
<advanced-search-field type="cpf" label="CPF" field="cpf"></advanced-search-field>
<advanced-search-field type="cnpj" label="CNPJ" field="cnpj"></advanced-search-field>
<advanced-search-field type="boolean" label="Ativo" field="ativo" true-label="True" false-label="False"></advanced-search-field>
<advanced-search-field type="select" label="Estados" field="id" data="selects"></advanced-search-field>
<advanced-search-field type="enum" label="Roles" field="states" data="selects"></advanced-search-field>
</gumga-filter>
@guiseek
guiseek / angular-facebook-sdk-factory.js
Last active August 5, 2016 04:25
AngularJS Facebok Sdk Factory
export default class FacebookFactory {
constructor($window, $timeout, $q) {
this.options = {
appId: null,
status: true,
cookie: false,
xfbml: false,
version: 'v2.4',
scope: ''
}
@guiseek
guiseek / fixedOnScroll.directive.js
Created August 5, 2016 03:51
Diretiva para fixar elemento visível na tela (usa positioin sticky, não tem suporte ao Chrome)
export default class FixedOnScroll {
constructor($window) {
this.restrict = 'A'
this.window = $window
}
link(scope, elem, attrs) {
let e = elem[0],
offset = attrs.offset || 0,
top = attrs.top || 0
@guiseek
guiseek / address-autocomplete.component.html
Created January 29, 2019 01:47
Angular 7 + AGM + Auto Complete Address (Material Angular)
<mat-form-field class="w-full" appearance="outline">
<mat-label>Localize sua empresa no mapa</mat-label>
<input type="text" placeholder="Procure pelo nome da empresa ou endereço" matInput [formControl]="searchInput" [matAutocomplete]="auto">
<mat-icon matSuffix>place</mat-icon>
<mat-hint>Ao selecionar, ajuste o ponto no mapa se necessário</mat-hint>
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn" (optionSelected)="onChangeAddress($event)">
<mat-option class="address-option" *ngFor="let option of options" [value]="option">
<mat-icon matSuffix>place</mat-icon>
<span class="place">{{option.structured_formatting.main_text}}</span>
<small class="address">{{option.structured_formatting.secondary_text}}</small>
export interface ErrorMessages {
[k: string]: string;
}