Skip to content

Instantly share code, notes, and snippets.

View guilhermeblanco's full-sized avatar

Guilherme Blanco guilhermeblanco

  • Orlando, FL, USA
  • 15:00 (UTC -04:00)
View GitHub Profile
<?php
class HairColor implements ReflectionAnnotation {
public $hairColor = "";
}
[HairColor(hairColor="purple")]
class PurplePeopleEater { }
<?php
// current implementation
class HairColor implements ReflectionAnnotation {
public $hairColor = "";
}
[HairColor(hairColor="purple")]
class PurplePeopleEater { }
@guilhermeblanco
guilhermeblanco / resize_animated_gif.php
Created February 11, 2011 02:51
With PECL Imagick extension and using PHP
<?php
$maxWidth = 200;
$maxHeight = 200;
try {
$imagick = new Imagick();
$fh = fopen(__DIR__ . '/batman.gif', 'r');
$imagick->readImageFile($fh);
@guilhermeblanco
guilhermeblanco / EntityRepository_applyFilter.php
Created February 17, 2011 16:07
EntityRepository::applyFilter(Filter $filter)
class EntityRepository
{
public function applyFilter(Filter $filter)
{
$qb = $this->createQueryBuilder('e');
$filter->apply($qb);
return $qb->getQuery()->getResult();
}
@guilhermeblanco
guilhermeblanco / Command.js
Created January 9, 2012 21:14
Widget support in PureMVC
Object.declare('base.widget.Command');
base.widget.Command = function ()
{
org.puremvc.js.patterns.command.SimpleCommand.call(this);
};
Object.extend(base.widget.Command, org.puremvc.js.patterns.command.SimpleCommand);
Object.declare('base.page.index.IndexStartupCommand');
base.page.index.IndexStartupCommand = function ()
{
base.page.PageMacroCommand.call(this);
};
Object.extend(base.page.index.IndexStartupCommand, base.page.PageMacroCommand);
var _p = base.page.index.IndexStartupCommand.prototype;
@guilhermeblanco
guilhermeblanco / Command.js
Created January 9, 2012 21:31
Widget implementation in PureMVC
Object.declare('base.widget.sampleWidget.Command');
base.widget.sampleWidget.Command = function ()
{
base.widget.Command.call(this);
};
Object.extend(base.widget.sampleWidget.Command, base.widget.Command);
var _p = base.widget.sampleWidget.Command.prototype;
<?php
function validateProducts($storeData) {
// Check to make sure that our valid fields are in there
$requiredFields = array(
'price',
'name',
'description',
'type',
@guilhermeblanco
guilhermeblanco / gist:2369944
Created April 12, 2012 18:38 — forked from hay/gist:1351230
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
/**
* @Assert\RemapField(targetEntity="User", property="name")
*/
protected $name;