Skip to content

Instantly share code, notes, and snippets.

View mickaelandrieu's full-sized avatar
🏠
Working from home

Mickaël Andrieu mickaelandrieu

🏠
Working from home
View GitHub Profile
@bpizzi
bpizzi / gist:669191
Created November 9, 2010 15:00
Nginx site conf for symfony 1.4
We couldn’t find that file to show.
@jubianchi
jubianchi / sf2_standalone_form.php
Created August 25, 2011 07:31
How to use Symfony2 Form Component Standalone
<?php
namespace Standalone\Form;
use \Symfony\Component\HttpFoundation as SHttp;
use \Symfony\Component\Form as SForm;
use \Symfony\Component\DependencyInjection as SDI;
use \Symfony\Bridge as SBridge;
//Register all your autoload function here
//...
@jakzal
jakzal / KernelAwareTest.php
Last active October 16, 2022 11:08
KernelAwareTest
<?php
require_once dirname(__DIR__).'/../../../../app/AppKernel.php';
/**
* Test case class helpful with Entity tests requiring the database interaction.
* For regular entity tests it's better to extend standard \PHPUnit_Framework_TestCase instead.
*/
abstract class KernelAwareTest extends \PHPUnit_Framework_TestCase
{
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@dunglas
dunglas / invite-friends.js
Last active May 23, 2016 20:56
Invite all your Facebook friends (v3)
// Scroll to the bottom of the friend list and type the following line in your console
// For checkboxes (e.g. invite to an event)
var c = document.querySelectorAll("a[role='checkbox']"); for (var i = 0; i < c.length; i++) c[i].click();
// For invite buttons (e.g. invite to like a page)
var c = document.querySelectorAll(".uiButton._1sm"); for (var i = 0; i < c.length; i++) c[i].click();
@alexandresalome
alexandresalome / do.sh
Created September 28, 2012 12:50
generate self-signed SSL certificate
# Generate a private key
openssl genrsa -des3 -out server.key.org 1024
# Generate a CSR: Certificate Signing Request
openssl req -new -key server.key.org -out server.csr
# Remove password from key
openssl rsa -in server.key.org -out server.key
# Generate a self-signed certificate
@mnapoli
mnapoli / reference.yml
Last active January 12, 2023 00:08
Doctrine YAML configuration reference
# Inspired from http://blog.hio.fr/2011/09/17/doctrine2-yaml-mapping-example.html
MyEntity:
type: entity
repositoryClass: MyRepositoryClass
table: my_entity
namedQueries:
all: "SELECT u FROM __CLASS__ u"
# Class-Table-Inheritance
@bjo3rnf
bjo3rnf / EntityHiddenType.php
Last active November 19, 2021 17:19
Hidden field for Symfony2 entities
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
@ludofleury
ludofleury / getset.sublime-snippet
Created February 15, 2013 02:25
PHP (Symfony) oriented getter-setter snippet for Sublime Text
<snippet>
<content><![CDATA[
/**
* Get $1
*
* @return ${2:[type]} \$$1
*/
public function get${1/(.*)/\u$1/}()
{
return \$this->${1:$SELECTION};
@ludofleury
ludofleury / atoum-is-awesome.php
Created March 8, 2013 10:44
The power of atoum, everything in my job should be so simple.
<?php
public function testAddBox()
{
$package = new Entity\Package();
$box = new \Mock\MyLittle\Bundle\BoxBundle\Entity\Box;
$this
->object($package->addBox($box))
->isIdenticalTo($package)