Skip to content

Instantly share code, notes, and snippets.

View argentinaluiz's full-sized avatar

Luiz Carlos argentinaluiz

View GitHub Profile
@argentinaluiz
argentinaluiz / navigation.phtml
Last active March 27, 2019 13:58
A implementation to navigation menu from Bootstrap 2.x and 3.x using Zend Framework 2 and Twig
<?php
foreach ($this->container as $page):
$sub = $page->getPages();
$aAttribs = '';
$liClasses = array();
$liClass = '';
if ($page->isActive(true))
$liClasses[] = 'active';
@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 / zftool.bat
Created August 16, 2015 13:02
Command to execute zftool.phar globally in Windows
@ECHO OFF
php "%~dp0zftool.phar" %*
@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 / 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 / composer.json
Last active March 27, 2019 23:23
Doctrine configuration for Zend-Expressive
....
"zendframework/zend-stdlib": "~2.7.0",
"zendframework/zend-servicemanager": "~2.7.3",
"doctrine/doctrine-orm-module": "0.10.0",
....
@argentinaluiz
argentinaluiz / index.html
Last active October 13, 2023 00:16
Quickstart with Angular 2
<html>
<head>
<title>Angular 2 - School of Net</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>