Skip to content

Instantly share code, notes, and snippets.

@tystr
tystr / deploy.rb
Created February 21, 2013 22:20
Clearing APC cache when deploying a symfony2 application
# Clear APC caches
after "deploy:finalize_update" do
pretty_print "--> Clearing APC caches"
run "cd #{release_path} && php app/console apc:clear --env=prod"
puts_ok
end
@johnkary
johnkary / symfony-live-2013-portland.md
Last active December 17, 2015 15:29
Slides from Symfony Live 2013 - Portland
@jhedstrom
jhedstrom / FeatureContext.php
Last active April 5, 2019 10:25
Step-definition for complex node structure (field collection + entity reference).
<?php
/**
* @Given /^I am viewing a product with the following related products:$/
*/
public function assertRelatedProducts(TableNode $relatedProducts) {
// First, create a product.
$product = (object) array(
'title' => 'Parent Product',
'type' => 'product',
'uid' => 1,
@yosymfony
yosymfony / index.php
Last active December 19, 2015 09:49
Simple skeleton for Silex application
<?php
require_once __dir__.'/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Simple skeleton for Silex
*
* Run in PHP >=5.4: $ php -S localhost:8080 -t web web/index.php
@fubhy
fubhy / .gitconfig
Last active September 20, 2016 02:51
My personal .gitconfig (mostly stolen from others) :-)
[user]
# Credentials.
name = Foo Bar
email = foo@bar.com
drupal = $(whoami)
[credential]
# Save passwords in ~/.git-credentials.
helper = store
@merk
merk / UserController.php
Last active December 22, 2015 08:19
User View Model
<?php
/**
* This file is part of the Project
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@yosymfony
yosymfony / TwigFactory.php
Last active December 22, 2015 18:09
A Twig factory
<?php
require_once '/path/to/lib/Twig/Autoloader.php';
/**
* A factory for create Twig instances
*
* @author Victor Puertas <vpgugr@gmail.com>
*
* Usage:
* <code>
// Datos view Template
$data=array(
//...
);
//Load lib
require_once'libs/Twig/Autoloader.php';
Twig_Autoloader::register();
//config path template
@wadmiraal
wadmiraal / gist:7532480
Created November 18, 2013 18:08
One useful use of override_function.
override_function('override_function', '$function_name, $function_args, $function_code', 'return override_function($function_name, $function_args, $function_code );');
@dmouse
dmouse / composer.json
Last active October 19, 2021 20:04
Run composer command from php script, controller, web,
{
"name": "hechoendrupal/composer-ui",
"description": "Composer UI",
"minimum-stability": "dev",
"authors": [
{
"name": "David Flore",
"email": "dmouse.x@gmail.com"
}
],