Skip to content

Instantly share code, notes, and snippets.

View jmikola's full-sized avatar
💭
🌭

Jeremy Mikola jmikola

💭
🌭
View GitHub Profile
@jmikola
jmikola / Document.php
Created May 18, 2012 15:51
Doctrine MongoDB ODM flush benchmark
<?php
use Doctrine\ODM\MongoDB\Mapping\Annotations as Mongo;
/** @Mongo\Document(collection="documents") */
class Document
{
/** @Mongo\Id */
public $id;
@jmikola
jmikola / ExampleFormType.php
Created March 22, 2012 23:53
Temp work-around for BC break in Symfony2 Form component's default option processing
<?php
namespace Acme\MainBundle\Form\Type;
use Acme\MainBundle\Form\Util;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class ExampleFormType extends AbstractType
{
@jmikola
jmikola / lcd_flicker.html
Created March 15, 2012 21:25
LCD flicker test
<html>
<body style="background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wDDxUWIIvw6PYAAAAXSURBVAjXY7555Qznr6/MnL++phQUAgA6Owe1wU3aygAAAABJRU5ErkJggg==);">
<h2 style="background-color: #fff; display: inline">Open a translucent, black terminal over this background</h2>
</body>
</html>
@jmikola
jmikola / RouterRequestContextPass.php
Created March 6, 2012 07:47
A cure for "localhost" appearing in absolute URL's when rendering a template from the Symfony2 CLI
<?php
namespace Application\ExerciseBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Overrides the default host for the Router's RequestContext service.
*
@jmikola
jmikola / mongo_shell.txt
Created February 12, 2012 21:53
MongoDB sorting orders for numeric integers and strings
[avocado: ~] $ mongo
MongoDB shell version: 2.0.2
connecting to: test
> db.foo.insert({x:10});
> db.foo.insert({x:"10"});
> db.foo.insert({x:5});
> db.foo.insert({x:"5"});
> db.foo.find().sort({x:-1});
{ "_id" : ObjectId("4f383479216ae77049825406"), "x" : "5" }
{ "_id" : ObjectId("4f383470216ae77049825404"), "x" : "10" }
@jmikola
jmikola / transcript.txt
Created January 5, 2012 18:21
Log of #symfony-dev meeting 20120105 (all times GMT-5)
Jan 05 11:01:39 <Seldaek> it's time (but I don't have time to be around too much, so I hope someone can manage this)
Jan 05 11:02:01 <fabpot> Hi all
Jan 05 11:02:23 <cordoval> this is the link just in case http://www.doodle.com/kxpxkrvhgnd2bx5i
Jan 05 11:02:57 <cordoval> and http://goo.gl/BWjAN - [WIP] Integrates metadata into Symfony validator goes first as it has 3 checks
Jan 05 11:03:08 * stodan has quit (Quit: Over & Out)
Jan 05 11:04:18 <fabpot> I have not read the PR, nor do I know anything about the metadata library but we already have loader in the Config components
Jan 05 11:04:25 <fabpot> that are already used in quite a few places
Jan 05 11:04:35 <fabpot> so the first question is why not reuse them for the validator component
Jan 05 11:04:58 <beberlei> henrik is not here, he suggestet that
Jan 05 11:05:12 <Stof> the goal of the Metadata libraries is mainly to manage the metadata after they are loaded
@jmikola
jmikola / MongoDBMigrateMetadataCommand.php
Created December 15, 2011 18:14
Migration script for OrnicarMessageBundle
<?php
namespace Ornicar\MessageBundle\Command;
use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@jmikola
jmikola / UserEditFormType.php.diff
Created December 12, 2011 22:18
Using Symfony2 form events to prevent overwriting fields with empty values
diff --git a/src/Application/UserBundle/Form/UserEditFormType.php b/src/Application/UserBundle/Form/UserEditFormType.php
index ea5bf44..150da51 100644
--- a/src/Application/UserBundle/Form/UserEditFormType.php
+++ b/src/Application/UserBundle/Form/UserEditFormType.php
@@ -3,7 +3,9 @@
namespace Application\UserBundle\Form;
use Symfony\Component\Form\FormBuilder;
+use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\AbstractType;
@jmikola
jmikola / xhtml-caption-1.mod
Created November 28, 2011 06:53
Modified XHTML DTD for a.caption attribute
<!-- ...................................................................... -->
<!-- XHTML Caption Module ................................................. -->
<!-- file: xhtml-caption-1.mod
This is XHTML, a reformulation of HTML as a modular XML application.
Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
This DTD module is identified by the PUBLIC and SYSTEM identifiers:
PUBLIC "-//arsjerm.net//ELEMENTS XHTML Caption 1.0//EN"
<?php
require __DIR__.'/../vendor/.composer/autoload.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = new UniversalClassLoader();
$loader->registerNamespaceFallbacks(array(__DIR__.'/../src',));
$loader->register();