Skip to content

Instantly share code, notes, and snippets.


Lorenz Haase silenzium

View GitHub Profile
silenzium / .htaccess
Created Oct 3, 2017
.htaccess for symfony 3 projects with LiipImagineBundle (performance boost by serving cached files directly from disc)
View .htaccess
# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html,
DirectoryIndex app.php
# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
# to the front controller "/app.php" but be rewritten to "/app.php/app".
<IfModule mod_negotiation.c>
silenzium / custom-react-toolbox.js
Created Mar 22, 2017
Import react-toolbox Components without Styles for use with react-toolbox-themr
View custom-react-toolbox.js
export AppBar from 'react-toolbox/lib/app_bar/AppBar';
export Autocomplete from 'react-toolbox/lib/autocomplete/Autocomplete';
export Avatar from 'react-toolbox/lib/avatar/Avatar';
export Button from 'react-toolbox/lib/button/Button';
export BrowseButton from 'react-toolbox/lib/button/BrowseButton';
export IconButton from 'react-toolbox/lib/button/IconButton';
silenzium / objectfit-fallback.js
Last active Nov 4, 2019
This is a simple fallback for the object-fit property on responsive images inside picture elements (with srcset and media-query sources). It hides the img on browsers that don't support object-fit and sets the current used image as a background-image with background-size:cover.
View objectfit-fallback.js
$(function() {
'use strict';
// the css selector for the container that the image should be attached to as a background-image
var imgContainer = '.cover-img picture';
function getCurrentSrc(element, cb)
var getSrc;
if (!window.HTMLPictureElement) {
silenzium / zf2ClearFormErrors
Last active Aug 29, 2015
ZF2 helper function to remove all errors in a form or fieldset recursively
View zf2ClearFormErrors
use Zend\Form\FieldsetInterface;
* Remove all errors in a form recursively
* pass a form or a fieldset as parameter
* @param FieldsetInterface $form
* @return void
public function clearFormErrors(FieldsetInterface $form)
You can’t perform that action at this time.