Skip to content

Instantly share code, notes, and snippets.

@WishCow
WishCow / getErrorMessages.php
Last active September 8, 2019 21:33 — forked from umpirsky/getErrorMessages.php
One of the new symfony releases (probably 2.1) broke the previous gist, because $form->getErrors() now returns a sequentially indexed array, instead of a fieldname => errormsg one.
<?php
private function getErrorMessages(\Symfony\Component\Form\Form $form) {
$errors = array();
if ($form->hasChildren()) {
foreach ($form->getChildren() as $child) {
if (!$child->isValid()) {
$errors[$child->getName()] = $this->getFormErrors($child);
}
@WishCow
WishCow / conig.yml
Created July 22, 2013 12:28
Assetic groups in Symfony2
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ YourBundle ]
assets:
frontend:
inputs:
- @YourBundle/Resources/public/css/cssreset-min.css
- @YourBundle/Resources/public/css/fonts.css
- @YourBundle/Resources/less/layout.less
@WishCow
WishCow / gist:5318376
Last active December 15, 2015 20:28
FormErrorResponse for handling AJAX submitted forms
<?php
protected function getFormErrors(Form $form) {
$errors = array();
$children = $form->all();
if (count($children)) {
foreach ($children as $child) {
if (!$child->isValid()) {
$errors[$child->getName()] = $this->getFormErrors($child);
@WishCow
WishCow / init.php
Last active December 15, 2015 06:39
Custom keyboard shortcuts for TinyTinyRSS
<?php
class MyKeys extends Plugin {
private $link;
private $host;
function about() {
return array(1.0,
"My custom keybindings",
"WishCow");
@WishCow
WishCow / readme.md
Last active August 29, 2015 14:11
Font handling in FUI components

How the fonts are supposed to work

  1. Place the font files under src/scss/fonts
  2. If the font is FontAwesome, it must be named fontawesome-webfont.*
  3. Include the fonts with the $font-face compass mixin, do not specify a path in the mixin
  4. Specify { font: build/fonts } in your compass config
  5. Modify your gulpfile.js, so that the build and distribution steps copy the fonts to build/, and dist/

If you did everything well: