Skip to content

Instantly share code, notes, and snippets.

View argentinaluiz's full-sized avatar

Luiz Carlos argentinaluiz

View GitHub Profile
@argentinaluiz
argentinaluiz / gist:ee94417d214e8f8403c2
Created February 7, 2015 01:55
convert latin to utf8
update table set field=convert(cast(convert(field using latin1) as binary) using utf8);
@argentinaluiz
argentinaluiz / Configurator.php
Created March 12, 2015 00:05
Classe para hidratar entidades
class Configurator {
/** Configure a target object with the provided options.
*
* The options passed in must be a Traversable object with option names for keys.
* Option names are case insensitive and will be stripped of underscores. By convention,
* option names are in lowercase and with underscores separated words.
*
* The target object is expected to have a setter method for each option passed. By convention,
* setters are named using camelcase with a 'set' prefix.
*
<?php
$urlPattern = $_SERVER['REQUEST_URI'];
$formatUrl = function ($page) use ($urlPattern) {
if (!preg_match('/page/', $urlPattern))
return $urlPattern . "/page/" . $page;
else
return preg_replace('/\d/', $page, $urlPattern);
};
?>
<center>
@argentinaluiz
argentinaluiz / Bootstrap.php
Created August 16, 2015 00:44
zf2 bootstrap
<?php
namespace CJSN;
use Zend\Loader\AutoloaderFactory;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager;
use Zend\Stdlib\ArrayUtils;
use RuntimeException;
error_reporting(E_ALL | E_STRICT);
@argentinaluiz
argentinaluiz / Configurator.php
Created September 9, 2015 13:24 — forked from gilsonDNA/Configurator.php
Configurator
<?php
namespace Livraria\Entity;
class Configurator {
public static function configure($target, $options, $tryCall = false)
{
if(!is_object($target))
@argentinaluiz
argentinaluiz / zftool.bat
Created August 16, 2015 13:02
Command to execute zftool.phar globally in Windows
@ECHO OFF
php "%~dp0zftool.phar" %*
@argentinaluiz
argentinaluiz / Handler.php
Created March 2, 2016 09:43
Solution to the conflict between oauth2-server-laravel and laravel-cors in return response header in oauth error
<?php
namespace App\Exceptions;
use Asm89\Stack\CorsService;
use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use League\OAuth2\Server\Exception\OAuthException;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
@argentinaluiz
argentinaluiz / readme.md
Created August 9, 2016 13:47
Comparision JQuery vs Vue.js
tinymce.init({
selector: 'textarea',
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools'
],
toolbar1: 'bold italic | fontselect | fontsizeselect | print preview media | forecolor backcolor emoticons',
toolbar2: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
@argentinaluiz
argentinaluiz / modal.component.js
Created November 26, 2016 17:06
Materialize Modal with Vue.js 1
export default {
template: `
<div :id="modal.id" class="modal">
<div class="modal-content">
<slot name="content"></slot>
</div>
<div class="modal-footer">
<slot name="footer"></slot>
</div>
</div>