Skip to content

Instantly share code, notes, and snippets.

Avatar

Elton Nicolau elton182

View GitHub Profile
@elton182
elton182 / validaContaSantander.js
Created Aug 5, 2019
Validação Digito Conta Corrente Santander
View validaContaSantander.js
var agencia = '0189'
var conta = '01017417'
var dig = 9
var retorno = validaSantander(agencia,conta,dig);
console.log(retorno);
function validaSantander(agencia, conta, digito){
@elton182
elton182 / datatablefilter.blade.php
Created Dec 8, 2017
datatable com filtros em colunas
View datatablefilter.blade.php
<div class="table-responsive">
<table class="table table-bordered table-striped table-responsive" id="table" cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th>Nome</th>
<th>Telefone</th>
<th>Celular</th>
<th>Data Nascimento</th>
<th>Ações</th>
</tr>
@elton182
elton182 / env.php
Last active Sep 18, 2017
Função para usar um arquivo como arquivo de ambiente (environment)
View env.php
<?php
/**
* retorna uma variavel de ambiente do arquivo .env
*
* @param [type] $var
* @return string
*/
function env($var)
{
@elton182
elton182 / gulpfile.js
Created Sep 17, 2017
Gulp File para compilar os assets no cake
View gulpfile.js
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var copy = require('gulp-copy');
gulp.task('minify-js', function () {
gulp.src('webroot/src/js/**/*.js')
.pipe(uglify())
.pipe(gulp.dest('webroot/js'));
@elton182
elton182 / template.php
Created Aug 14, 2017
logica que faz o parse de valores {{name}}
View template.php
<?php
function resolveTemplate($template,$data){
// search pattern
$pattern = '/{{([^}]+)}}/';
$callback = function ($match) use($data){
//var_dump($matches);
$string = trim($match[1]);
View create.blade.php
@extends('template')
@section('content')
<head>
<script type="text/javascript">
$(document).ready(function()
{
$("#valor").maskMoney({
prefix: "R$: ",
decimal: ",",
View fluig_datepicker.html
<div class="form-group">
<label for="only-date">Data Emissão</label>
<div class="input-group date" id="dataEmissao">
<input type="text" class="form-control" placeholder="Informe a data de emissão" name="dataEmissao">
<span class="input-group-addon">
<span class="fluigicon fluigicon-calendar"></span>
</span>
</div>
</div>
View CategoryControllerTest.php
<?php
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use App\User;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
@elton182
elton182 / Model.php
Last active Jun 5, 2017
Validar Data no CakePHP
View Model.php
$validator
->add('occurrence_date', 'custom', [
'rule' => function ($value, $context) {
Log::write('debug',$value);
$dia = intval(substr($value, 0,2));
$mes = intval(substr($value, 3,2));
$ano = intval(substr($value, 6,4));
@elton182
elton182 / PermissionMiddleWare
Last active Apr 20, 2017
Permission Middleware
View PermissionMiddleWare
<?php
namespace safed\Http\Middleware;
use Artesaos\Defender\Facades\Defender;
use Closure;
class Permission
{
/**