Skip to content

Instantly share code, notes, and snippets.

<?php
// put this into "dev/less/getcss.php"
// checkout lessphp into src/vendor: git clone git://github.com/leafo/lessphp.git
// add "Alias /dev/ /home/you/src/joiz/dev/" to your vhost
// add "RewriteRule ^main.css$ dev/less/getcss.php?cssfile=main [L]" to your vhost or .htaccess
// create app/config/main.less, use imports into your bundles (Resources/data/less/*)
// browse to http://[yourdomain]/main.css
$lessCompiler = __DIR__.'/../../src/vendor/lessphp/lessc.inc.php';
if (!include $lessCompiler) {
@lsmith77
lsmith77 / gist:648702
Created October 27, 2010 09:04
multiplexer to json-ify any controller as well as call multiple separate controllers via one request
<?php
namespace Application\FooBundle\Controller;
class MultiplexController
{
/**
* Request
* @var Symfony\Component\HttpFoundation\Request
*/
doctrine_user.config:
db_driver: odm
class:
model:
user: Bundle\ExerciseUserBundle\Document\User
group: ~
permission: ~
form:
user: ~
group: ~
<?php
namespace Bundle\MultiFrontControllerBundle\Test;
class WebTestCase extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
{
/**
* @see The class description
*/
public function __construct()
<?php
namespace Application\FooBundle\Test;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
class WebTestCase extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
{
<?php
namespace Application\FooBundle\Test;
/*
* The on-line validator: http://validator.nu/
* The documentation: http://about.validator.nu/
* Documentation about the web service: http://wiki.whatwg.org/wiki/Validator.nu_Web_Service_Interface
*/
class Html5WebTestCase extends WebTestCase
{
@lsmith77
lsmith77 / less processing with php and symfony2
Created January 1, 2011 13:04
In development the CSS file is generated on the fly, while the file is stored permanently in the production build script.
<?php
// RewriteRule ^css/main.css$ dev/less/getcss.php?cssfile=main [L]
header("Cache-Control: no-cache");
header('Content-Type: text/css');
if (isset($_GET['cssfile'])) {
$cache = generatecss($_GET['cssfile']);
if (isset($cache['compiled']) && is_array($cache)) {
@lsmith77
lsmith77 / Symfony2-in-the-trenches.markdown
Created January 16, 2011 09:04
this is just some notes in preparation for the slides
@lsmith77
lsmith77 / gist:812402
Created February 5, 2011 11:58
move to a single load method
### Before ###
## Doctrine Configuration
doctrine.dbal:
dbname: xxxxxxxx
user: xxxxxxxx
password: ~
logging: %kernel.debug%
doctrine.orm:
auto_generate_proxy_classes: %kernel.debug%
mappings:
@lsmith77
lsmith77 / gist:812538
Created February 5, 2011 15:41
user controlled config merging
###
# uses http://yaml.org/type/merge.html
# imports read the given file and define implicit merge key alias for all possible paths
###
# config.yml
foo: bar
# implicitly defines a &ding merge key alias
ding: