Skip to content

Instantly share code, notes, and snippets.

@giorrrgio
giorrrgio / Migration1.php
Created October 17, 2012 06:57
Symfony 2.1 Doctrine Migrations and Sluggable
<?php
namespace Application\Migrations;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Acme\MyBundle\Command\UpdateSlugsCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
@giorrrgio
giorrrgio / ImagineResizer.php
Last active August 1, 2018 08:34
best fit images
<?php
namespace Acme\MyBundle\Service;
use Symfony\Component\HttpFoundation\File\File;
use Imagine\Image\ImagineInterface;
use Imagine\Image\BoxInterface;
use Imagine\Image\Point;
use Imagine\Image\Box;
@giorrrgio
giorrrgio / raphael-svg-buildjson
Created August 27, 2012 09:49 — forked from benbarnett/raphael-svg-buildjson
loop through the 'paper' variable from Raphael JS and build up the JSON object describing all images and paths within it.
// loop through the 'paper' variable from Raphael JS and build up the JSON object describing all images and paths within it.
buildJSON = function(paper) {
var svgdata = [];
svgdata.push({
width: 390,
height: 400
});
$.each(paper,
@giorrrgio
giorrrgio / gist:3129752
Created July 17, 2012 14:34 — forked from chanon/gist:661597
Facebook iframe Canvas App Authentication in node.js
var querystring = require("querystring");
var base64ToString = function(str) {
return (new Buffer(str || "", "base64")).toString("ascii");
};
var base64UrlToString = function(str) {
return base64ToString( base64UrlToBase64(str) );
};