Skip to content

Instantly share code, notes, and snippets.

View GlauberF's full-sized avatar
🎯
Foco e determinação nos objetivos.

Glauber Funez GlauberF

🎯
Foco e determinação nos objetivos.
View GitHub Profile
@GlauberF
GlauberF / localStorageService.expire.js
Created July 28, 2017 18:08 — forked from Kyoss79/localStorageService.expire.js
Extend the localStorageService for Angular (https://github.com/grevory/angular-local-storage) with the possibility of expiring entries.
/**
* extend the localStorageService (https://github.com/grevory/angular-local-storage)
*
* - now its possible that data stored in localStorage can expire and will be deleted automagically
* - usage localStorageService.set(key, val, expire)
* - expire is an integer defininig after how many hours the value expires
* - when it expires, it is deleted from the localStorage
*/
app.config(($provide) => {
$provide.decorator('localStorageService', ($delegate) => {
@GlauberF
GlauberF / example.html
Created August 2, 2017 17:12 — forked from 981746/example.html
A simple AngularJS service for handling the 'onbeforeunload' event
<!DOCTYPE html>
<html data-ng-app="TestApp">
<head>
<script src="http://code.angularjs.org/1.2.9/angular.js"></script>
<script>
angular.module('TestApp', [])
.factory('beforeUnload', function ($rootScope, $window) {
// Events are broadcast outside the Scope Lifecycle
@GlauberF
GlauberF / angularjs-providers-explained.md
Created August 18, 2017 14:41 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@GlauberF
GlauberF / bancos_brasileiros.php
Created July 24, 2018 17:08 — forked from peuweb/bancos_brasileiros.php
Lista dos bancos brasileiros em formato array
<?php
//bancos brasileiros
$bancos = array(
array('code' => '001', 'name' => 'Banco do Brasil'),
array('code' => '003', 'name' => 'Banco da Amazônia'),
array('code' => '004', 'name' => 'Banco do Nordeste'),
array('code' => '021', 'name' => 'Banestes'),
array('code' => '025', 'name' => 'Banco Alfa'),
array('code' => '027', 'name' => 'Besc'),
array('code' => '029', 'name' => 'Banerj'),
@GlauberF
GlauberF / php7.1.md
Created August 2, 2018 02:35 — forked from VirtuBox/php7.1.md
How to install php7.1-fpm with EasyEngine

How to install php7.1-fpm with EasyEngine


Install php7.1-fpm

apt install php7.1-common php7.1-cli php7.1-zip php7.1-opcache php7.1-mysql php7.1-mcrypt php7.1-mbstring php7.1-json php7.1-intl php7.1-gd php7.1-fpm php7.1-curl php7.1-bz2

Copy the php7.1-fpm pool configuration from php7.0-fpm

cp -f /etc/php/7.0/fpm/pool.d/www.conf /etc/php/7.1/fpm/pool.d/www.conf
#!/bin/bash
set -e # termina o script com um código diferente de 0 se alguma coisa falhar
# roda o script de build da nossa aplicação
npm run build
# pull requests e commits para outras branches diferentes da master
# não devem fazer o deploy, isso é opcional caso queira deletar as próximas 6 linhas
# fique a vontade
SOURCE_BRANCH="master"
@GlauberF
GlauberF / angularjs-http-get-xml.html
Created August 9, 2018 18:45
AngularJS $http Service (GET XML)
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>$http Service | AngularJS</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js"></script>
<script type="text/javascript">
<!--
(function() {
@GlauberF
GlauberF / async validation with debounce
Created August 6, 2019 17:26 — forked from ellipizle/async validation with debounce
async validation with debounce listening to value change
import { Component, OnInit } from '@angular/core';';
import { FormBuilder, FormGroup, Validators, AbstractControl, ValidationErrors } from '@angular/forms';
import { Router } from '@angular/router'
import { CommonValidators } from '../service/CommonValidator';
import { Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { GlobalService } from '../../shared/service/global.service';
import { AuthHttp } from 'angular2-jwt'
declare var $: any;
import 'rxjs/add/operator/delay';
import { ComponentFactoryResolver, ComponentRef, Directive, EventEmitter, Input, Type, ViewContainerRef } from '@angular/core';
import { Subscription } from 'rxjs';
@Directive({
selector: '[lazyComp]'
})
export class LazyCompDirective {
private _inputs;
private _outputs;
private subscription = new Subscription();
@GlauberF
GlauberF / date-fns-date-adapter.ts
Created February 2, 2021 18:54 — forked from JoniJnm/date-fns-date-adapter.ts
date-fns angular material adapter
import {Injectable} from '@angular/core';
import {DateAdapter} from '@angular/material';
import {addDays, addMonths, addYears, format, getDate, getDaysInMonth, getMonth, getYear, parse, setDay, setMonth, toDate} from 'date-fns';
// CONFIG. Use environment or something for a dynamic locale and settings
import {es as locale} from 'date-fns/locale';
const WEEK_STARTS_ON = 1; // 0 sunday, 1 monday...
export const MAT_DATE_FNS_DATE_FORMATS = {