Skip to content

Instantly share code, notes, and snippets.

View mauricerenck's full-sized avatar

Maurice Renck mauricerenck

View GitHub Profile
@mauricerenck
mauricerenck / rss-exsample.php
Created February 17, 2023 15:02
kirby rss example
<?php
// Bei mir spielen mehrere Dateien eine Rolle
// Die Query für die einzelnen Beitragsquellen habe ich in collections: https://getkirby.com/docs/guide/templates/collections
// blog collection:
return function ($site) {
return page('blog')->index()->listed();
};
// Die Daten trage ich im controller für die sitemap zusammen:
<?php
namespace mauricerenck\Komments;
$kommentUtils = new KommentBaseUtils();
$komments = $kommentUtils->parseKomments($page->kommentsInbox());
$kommentList = ['LIKES' => [], 'REPOSTS' => [], 'REPLIES' => [], 'MENTIONS' => []];
$kommentsInModeration = 0;
function addReply($komment)
inputField.addEventListener('keyup', event => {
// prevent some evil queries
const keyword = inputField.value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
// at least two chars needed to trigger the search
if (keyword.length < 2) {
return false
}
<?php
class EpisodeTemplateNamePage extends Page
{
public function podcasterDescription()
{
$field = new Field($this, 'podcasterDescription', $this->podcasterDescription()->value() . $this->podcasterContent()->value());
return $field;
}
}
export const initLazyloading = (selector: string): void => {
let images = document.querySelectorAll(selector)
if ('IntersectionObserver' in window) {
// Create new observer object
let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
// Loop through IntersectionObserverEntry objects
entries.forEach(function(entry) {
// Do these if the target intersects with the root
if (entry.isIntersecting) {
export const initLazyloading = (selector: string): void => { let images = document.querySelectorAll(selector) if ('IntersectionObserver' in window) { // Create new observer object let lazyImageObserver = new IntersectionObserver(function(entries, observer) { // Loop through IntersectionObserverEntry objects entries.forEach(function(entry) { // Do these if the target intersects with the root if (entry.isIntersecting) { let lazyImage: any = entry.target lazyImage.src = lazyImage.dataset.src lazyImage.classList.remove('lazy') lazyImage.classList.add('lazyloaded') lazyImageObserver.unobserve(lazyImage) } }) }) // Loop through and observe each image images.forEach(function(lazyImage) { lazyImageObserver.observe(lazyImage) }) } }
<!-- right after <body> -->
<div class="fader"></div>
<script>
const fader = document.querySelector('.fader')
fader.classList.add('fade');
</script>
<!-- before </body> -->
<!-- Dublin Core -->
<meta name="DC.Title" content="<?php echo $title ?>">
<meta name="DC.Creator" content="<?php echo $site->author() ?>">
<meta name="DC.Rights" content="<?php echo $site->author() ?>">
<meta name="DC.Publisher" content="<?php echo $site->author() ?>">
<meta name="DC.Description" content="<?php echo $page->seoDescription() ?>">
<meta name="DC.Language" content="<?php echo $kirby->language()->code(); ?>">
<meta name="DC.Subject" content="<?php echo $page->seoKeywords() ?>">
<meta name="DC.Type" content="Text">
<meta name="DC.Format" content="text/html">
{
"ab":{
"name":"Abkhaz",
"nativeName":"аҧсуа"
},
"aa":{
"name":"Afar",
"nativeName":"Afaraf"
},
"af":{
@mauricerenck
mauricerenck / dnsmasq.md
Last active February 20, 2019 12:19
make .test domains available without /etc/hosts

setting up .test TLD for local development

  1. Install dnsmasq: brew install dnsmasq
  2. cd $(brew --prefix); mkdir etc; echo 'address=/.test/127.0.0.1' > etc/dnsmasq.conf
  3. sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
  4. sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
  5. sudo mkdir /etc/resolver
  6. sudo bash -c 'echo "nameserver 127.0.0.1" &gt; /etc/resolver/test'