Skip to content

Instantly share code, notes, and snippets.

View medienbaecker's full-sized avatar
🥨

Thomas Günther medienbaecker

🥨
View GitHub Profile
@medienbaecker
medienbaecker / thumbs.php
Last active March 15, 2024 10:00
Generate all thumbnails with Kirby CLI
<?php
declare(strict_types = 1);
set_time_limit(0);
use Kirby\CLI\CLI;
use Kirby\Toolkit\Dir;
use Kirby\Toolkit\Str;
use Kirby\Cms\Media;
@medienbaecker
medienbaecker / link-field.md
Last active October 19, 2020 11:47
Link Field
@medienbaecker
medienbaecker / preprocess.sh
Created October 14, 2020 08:56
Nova SCSS task for Kirby projects
# Automatically get folder name to get Valet URL
domain=$(basename "$PWD");
# Watch style.scss and compile it
node-sass -w assets/scss/style.scss assets/css/style.css |
# Browsersync on Valet URL
browser-sync start --proxy "$domain.test" --host "$domain.test" --open 'external' --files 'assets/css/*.css'
@medienbaecker
medienbaecker / config.php
Created May 6, 2020 11:23
Programmatically add template to images
<?php
return [
'routes' => [
[
'pattern' => 'imagetemplates',
'action' => function () {
$result = '';
foreach(site()->index() as $page) {
$result .= '<h2>' . $page->title() . '</h2>';
<?php foreach($sections->children()->listed() as $section): ?>
<?php snippet('sections/' . $section->intendedTemplate(), array('page' => $section)) ?>
<?php endforeach ?>
@medienbaecker
medienbaecker / shy.php
Created April 8, 2019 14:24
(-) to &shy; KirbyTag hook
<?php
Kirby::plugin('medienbaecker/shy', [
'hooks' => [
'kirbytags:before' => function ($text, $data, $options) {
return Str::replace($text, "(-)", "&shy;");
}
]
]);
@medienbaecker
medienbaecker / section.php
Last active April 12, 2019 12:41
Page model for sections
<?php
# site/models/section.php
class SectionPage extends Page {
public function url($options = null): string {
return $this->parents()->filterBy("intendedTemplate", "!=", "sections")->first()->url() . '#' . $this->slug();
}
}
@medienbaecker
medienbaecker / GIF-Screencast-OSX.md
Created November 24, 2017 11:49 — forked from baumandm/GIF-Screencast-OSX.md
OS X Screencast to Animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime and ffmpeg.

Forked from https://gist.github.com/dergachev/4627207. Updated to use a palette to improve quality and skip gifsicle.

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: