Skip to content

Instantly share code, notes, and snippets.

View screeny05's full-sized avatar

Sebastian Langer screeny05

View GitHub Profile
<?php
/**
* Turn a media-id into a valid path
* @param $params
* @param $template
* @return string
*/
function smarty_function_mediaById($params, $template)
{
$id = $params['id'];
<?php
/**
* Custom EventExtension needed to subscribe to global buildForm Event
*/
use Shopware\Bundle\FormBundle\Extension\EventExtension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
@screeny05
screeny05 / sw-compile-theme.sh
Created December 12, 2016 09:32
shopware compile all themes
bin/console sw:theme:dump:config
cd themes
for f in ../web/cache/config_*.json;
do sudo grunt less:production uglify:production --config-id=$(echo $f | grep -Po '\d+');
done
@screeny05
screeny05 / sw5.htaccess
Last active December 8, 2016 13:53 — forked from emtii/sw5.htaccess
Shopware 5 mod_expires & mod_filter
<IfModule mod_mime.c>
# Missing media types
AddType audio/mp4 f4a f4b m4a
AddType audio/ogg oga ogg opus
AddType image/bmp bmp
AddType image/svg+xml svg svgz
AddType image/webp webp
AddType video/mp4 f4v f4p m4v mp4
AddType video/ogg ogv
AddType video/webm webm
@screeny05
screeny05 / bemlinter.js
Created November 10, 2016 09:59
BEM / ITCSS Linter
(function bemLinter(){
const namespaces = ['o', 'c', 'u', 's', 't', 'is', 'has'];
const suffixes = ['xs', 's', 'ms', 'sm', 'md', 'lg', 'l', 'xl', 'print'];
const SEVERITY_ERROR = 'error';
const SEVERITY_WARNING = 'warn';
const SEVERITY_INFO = 'info';
const ERR_TYPE_STRAY_ELEMENT = 'stray-element';
const ERR_TYPE_MISSING_NAMESPACE = 'missing-namespace';
$(':not([class], [id], [name], [for], [style], [itemprop], [href], [src], [property], [content], [lang], [charset], [rel], [value], [alt], [title], [action], [method], [type], [scoped], [required], br, body, head, html)')

Keybase proof

I hereby claim:

  • I am screeny05 on github.
  • I am screeny05 (https://keybase.io/screeny05) on keybase.
  • I have a public key ASCb6ToMaj_6Dyg23KG_tpG9oAMGkog1rgm_i46AG1zwvwo

To claim this, I am signing this object:

@screeny05
screeny05 / aeach.js
Last active August 29, 2015 14:24
async js fn-queuing
async.each = function(toIterate, fn, callback){
var calledCount = 0;
for (var i = 0; i < toIterate.length; i++) {
fn(toIterate[i], function(err){
if(err){
callback(err);
callback = function(){};
return;
}
calledCount++;