Skip to content

Instantly share code, notes, and snippets.

View marcaum54's full-sized avatar

Marcos Fábio dos Santos Amaral Júnior marcaum54

View GitHub Profile
<?php
$pathCsv = __DIR__ . '/arquivos/';
$arquivos = array(
'contas1.csv',
'contas2.csv'
);
$rows = array();
<?php
try
{
$x = new SoapClient((string)$this->url);
}
catch (SoapFault $e)
{
$this->setMessage('Servidor Indisponivel. Por favor, entre em contato com nosso setor financeiro.');
$this->setRedirect('index.php?option=com_ag&view=login');
@marcaum54
marcaum54 / fortes_meeting
Last active August 29, 2015 14:01
HTML do Email Marketing
<html>
<head><title></title></head>
<body style="background-color: #FFF;">
<table style="margin: 0 auto; width: 600px; border:0; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td><img src="http://fortesinformatica.com.br/v3/i/newsletters/2014/fortes_meeting/bg-01.png" /></td>
</tr>
<tr>
<td align="center" valign="middle" style="height: 80px;">
ERROR | NASH - Contas a Receber - Dados: Informação fornecida pelo NASH - Status: '3' | Erros: Array
(
[0] =>
)
Contas a Receber: ContaAReceber Object
(
[Empresa] =>
[Cliente] => Cliente Object
(
protected function get400() {
$content = $this->getHttpObject()->getContent();
$erros = json_decode($content, true);
$erro = array();
if (is_array($erros)) {
if (key_exists("Erros", $erros) && is_array($erros["Erros"])){
foreach ($erros["Erros"] as $key => $value) {
$('#mc-form').validate({
highlight: function(element, errorClass) {
$(element).fadeOut(function() {
$(element).fadeIn();
});
},
rules: {
name: {
required: true,
minlength: 2
Since I was looking all around how to uninstall packages and after reading tones
of documentations here's the short how-to uninstall a workbench package in Laravel
(or how I managed it to work out):
1. Remove package service provider from 'providers' array in app/config/app.php
2. Remove the package folder in workbench/
3. Run:
@marcaum54
marcaum54 / gist:9288fca85790f8d0ad9f
Created May 14, 2015 19:49
Laravel: Regex Validators
$examples = [
'cpf' => [ 'regex:/^\d{3}.\d{3}.\d{3}-\d{2}$/' ],
'cnpj' => [ 'regex:/^\d{2}.\d{3}.\d{3}\/\d{4}-\d{2}$/' ],
'telefone' => [ 'regex:/^\(\d{2}\) \d{4}-\d{4,5}$/' ],
'cep' => [ 'regex:/^\d{5}-\d{3}$/' ],
];
@marcaum54
marcaum54 / gist:afc90cbfa156194cac5a
Last active August 29, 2015 14:23
Exemplo de como tratrar problema de encoding em arquivos .CSV
function csv($items)
{
$fileName = date('Y-m-d_H-i-s') . '.csv';
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename={$fileName}");
//BUGFIX - Adiciona o BOM
echo chr(255) . chr(254);
@marcaum54
marcaum54 / gist:826e0d22fedd1de267e6
Created July 5, 2015 03:23
Removendo todos os .svn do projeto
find . -name .svn -exec ls {} \;
find . -name .svn -exec rm -rf {} \;