Skip to content

Instantly share code, notes, and snippets.

View foobartel's full-sized avatar

Holger Bartel foobartel

View GitHub Profile
@foobartel
foobartel / string-replace-css-url
Created October 15, 2014 03:06
Grunt string-replace CSS url to rails asset
// string-replace in two passes, because of bug?, reason is apparently related to lodash template security
// find: ": url(img/imagename)"
//replace: "url(<%= asset_path 'img/imagename' %>)"
'string-replace': {
inline: {
files: {
'dist/css/app.css.erb': ['css/app.css'],
},
options: {
@foobartel
foobartel / svg-fallback
Created October 16, 2014 04:17
Simple SVG Fallback
<!-- The simplest way to have PNG fallback for browsers without SVG support:
hattip by @viljamis -->
<img src="logo.svg" onerror="this.onerror=null;this.src='logo.png'">

Keybase proof

I hereby claim:

  • I am foobartel on github.
  • I am foobartel (https://keybase.io/foobartel) on keybase.
  • I have a public key whose fingerprint is 203E FDA8 9E19 D8B9 4949 FA0A 1B6D A7D9 3592 8F89

To claim this, I am signing this object:

@foobartel
foobartel / regex-sample.txt
Created August 21, 2015 10:16
Sample file for regex issue with repeat patterns
---
title: Newsletter Design Issues with Outlook 2010
layout: post
permalink: /2012/04/newsletter-design-issues-with-outlook-2010/
categories:
- Code
- Design
- Web Dev
@foobartel
foobartel / gulp-shopify-css-assets.js
Created August 2, 2016 09:36
Convert CSS background image paths to Shopify asset paths
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var replace = require('gulp-replace');
var rename = require("gulp-rename");
/*
Gulp task to convert CSS background image paths to Shopify asset urls,
e.g. url(/images/background.jpg) -> url({{ 'background.jpg' | asset_url }})
*/

Problem:

In TheFilterBar there are two filter options that pass a value to App.vue and it is currently only possiby to filter by either one value.

Desired solution:

I would like to be able to filter by either value or by both values together, but can't get to the second value, once the other has been updated. The methods below need to be adjusted, but at the moment I can't get the second value… A result like this with the method taking multiple arguments, e.g. filteredPosts(type, area) would be the preferred outcome:

@foobartel
foobartel / config.php
Last active August 27, 2019 06:18
A Kirby 3 plugin to output optimised images in content textarea fields.
<?php
return [
// default values for optimage tag if no values are set
'optimagetag' => [
'width' => '1200',
'height' => null,
'quality' => '55'
]
@foobartel
foobartel / image.php
Created June 26, 2020 07:20
Kirby 3 Editor - Resize images in Editor snippet
<?php if( $block->isNotEmpty() ): ?>
<figure<?= attr( [ 'class' => $attrs->css()->value() ], ' ' ) ?>>
<?php if( $attrs->id()->toFile() ): ?>
<?php $imagesrc = $attrs->id()->toFile()->resize( 1200, null, 60 )->url(); ?>
<?php else: ?>
<?php $imagesrc = $src ?>
<?php endif ?>
<?php if( $attrs->link()->isNotEmpty() ): ?>
@foobartel
foobartel / config.php
Last active August 15, 2021 08:54
Kirby 3 Image Block with support for webp, avif and native lazy loading
# Add to Kirby configuration
# avif image format currently only works with the ImageMagick driver
return [
'thumbs' => [
'driver' => 'im',
],
]
@foobartel
foobartel / README
Created December 9, 2021 08:58
Create Kirby pages from CSV file
# csv2file
This script converts the content of a CSV file into a folder structure with TXT files as their content ready to use in Kirby.
# Example Input/Output
**CSV file input:**
`field1; field2; field3; field4`