MemoTek

Regex

2014.11.19

Test your regex online !
http://regex101.com/

Expose your Symfony2 routing to client applications

2014.11.04

This bundle allows you to expose your routing in your JavaScript code. That means you'll be able to generate URL with given parameters like you can do with the Router component provided in the Symfony2 core.
FOSJsRoutingBundle Github

Symfony 2 : Render only HTML form for AJAX

2014.10.29

/**
* Function to put attribute on a symfony form returning the his view
* @param FormInterface $form
* @param array $options
* @return \Symfony\Component\Form\FormView */ public static function getFormView(FormInterface $form, $options = array())
{
  $formView = $form->createView();
  foreach ($options as $key => $value) {
   $formView->vars['attr'][$key] = $value;
  }

  return $formView;
}

------------------------------------------------------------------------------

$options = array(
  'id' => '...',
  class' => '...',
);
$formView = $this->getFormView($form, $options);
if ($request->isXmlHttpRequest() && $request->getMethod() == 'POST') {
  return $this->render('Bundle:Form:form.html.twig', array('form' => $formView));
}

Border VS Box-shadow

2014.10.23

Flat design is everywhere. One time, I had to debug flat buttons with borders like this :

normal hover

The issue was that the border moves the position buttons on hover. One solution was to substracted the delta position. But it brings new issue, especially on Internet Explorer.

The good solution was to replace the border by a box-shadow. Why ? Because box-shadow does not modify the box-size of an element, unlike the border. So it won't modify the position of the element. As you can see below :

border box-shadow

But box-shadow is a CSS 3 property. Yes, that's true. You can use this library to render CSS3 features in IE : CSS3pie.com

Tested on : IE 7, IE 8, IE 9, IE 10, Chrome 38, Chromium 33, Firefox 28
That's all !

SfPot - 2014.10.22

2014.10.22

Some interesting technologies picked up at last SfPot :