Skip to content

Instantly share code, notes, and snippets.

Avatar

Kéri Norbert Miklós WishCow

View GitHub Profile
@WishCow
WishCow / readme.md
Last active Aug 29, 2015
Font handling in FUI components
View readme.md

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:

@WishCow
WishCow / conig.yml
Created Jul 22, 2013
Assetic groups in Symfony2
View conig.yml
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 Dec 15, 2015
FormErrorResponse for handling AJAX submitted forms
View gist:5318376
<?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 Dec 15, 2015
Custom keyboard shortcuts for TinyTinyRSS
View init.php
<?php
class MyKeys extends Plugin {
private $link;
private $host;
function about() {
return array(1.0,
"My custom keybindings",
"WishCow");
@WishCow
WishCow / getErrorMessages.php
Last active Sep 8, 2019 — 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.
View getErrorMessages.php
<?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);
}
You can’t perform that action at this time.