Skip to content

Instantly share code, notes, and snippets.

<?php
class MySingleton implements ISubject
{
private static $instance = null;
private $myObservers = [];
private function __construct($param1, $param2, $param3)
{
@jl91
jl91 / snake
Created January 19, 2016 21:41
jsSnake
(function () {
var self = this;
var canvas = document.getElementById('mainCanvas');
var context = canvas.getContext('2d');
var x = 0;
var y = 0;
var oldX = 0;
var oldY = 0;
var sqrW = 10;
<?php
function generatePrimes($howMany)
{
$numbers = [];
$i = 2;
while (count($numbers) < (int) $howMany) {
<?php
$valor = 4;
function exemploPonteiro1(&$valor1)
{
$valor1++;
return $valor1;
}
$resultado = exemploPonteiro1($valor);
@jl91
jl91 / Whoops.php
Created February 2, 2016 21:45
Whoops.local.php
<?php
return [
'dependencies' => [
'invokables' => [
'Zend\Expressive\Whoops' => Whoops\Run::class,
'Zend\Expressive\WhoopsPageHandler' => Whoops\Handler\PrettyPageHandler::class,
],
'factories' => [
'Zend\Expressive\FinalHandler' => Zend\Expressive\Container\WhoopsErrorHandlerFactory::class,
@jl91
jl91 / local.php
Created February 2, 2016 21:48
Disable cache for local files Expressive
<?php
return [
'debug' => true,
'config_cache_enabled' => false,
];
@jl91
jl91 / SelectOptionLocalesLanguages.html
Created June 2, 2016 23:27
Select options with all locale languages
<select>
<option value="af_NA"> Afrikaans (Namibia)</option>
<option value="af_ZA"> Afrikaans (South Africa)</option>
<option value="af"> Afrikaans</option>
<option value="ak_GH"> Akan (Ghana)</option>
<option value="ak"> Akan</option>
<option value="sq_AL"> Albanian (Albania)</option>
<option value="sq"> Albanian</option>
<option value="am_ET"> Amharic (Ethiopia)</option>
<option value="am"> Amharic</option>
@jl91
jl91 / DoctrineRelationProvider.php
Created July 6, 2016 21:50 — forked from jdachtera/DoctrineRelationProvider.php
Automatically generate HATEOAS links for doctrine relations
<?php
namespace Acme\FooBundle\Hateoas;
use Doctrine\ORM\EntityManager;
use Hateoas\Configuration\Metadata\ClassMetadataInterface;
use Hateoas\Configuration as Hateoas;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouterInterface;
@jl91
jl91 / phalconphp_php7_ubuntu_16_04.sh
Created June 21, 2016 22:47 — forked from Tosyn/phalconphp_php7_ubuntu_16_04.sh
PhalconPhp with PHP7 Installation on Ubuntu 16.04
#!/bin/bash
# PhalconPhp with PHP7 installation on ubuntu:16.04
sudo apt-get update
sudo apt-get install -y php7.0-fpm \
php7.0-cli \
php7.0-curl \
php7.0-gd \
// var nomes = [
// "John",
// 'João',
// 'Marcia',
// 'Neide',
// 'Gabriel',
// 'Silvia',
// 'Maicon',
// 'daniel'
// ];