Skip to content

Instantly share code, notes, and snippets.

View marcus-herrmann's full-sized avatar

Marcus Herrmann marcus-herrmann

View GitHub Profile
@nicoknoll
nicoknoll / Guide.md
Last active August 29, 2015 14:04
Troubleshooting Processwire
@martinwolf
martinwolf / Preferences.sublime-settings
Last active October 8, 2015 19:18
Sublime Text 2 preferences
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/User/Espresso Soda.tmTheme",
"file_exclude_patterns":
[
".DS_Store",
"._*"
],
"folder_exclude_patterns":
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); // Outputs "fr", "en", "es", etc...
@trilodge
trilodge / Gruntfile.js
Last active May 17, 2017 08:07
Grunt Setup of Stylelint linting SCSS-Files based on postcss-scss and postcss-reporter
var path = require('path');
var fs = require('fs');
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
@arjenblokzijl
arjenblokzijl / split-processwire-array.php
Last active May 16, 2018 07:33
Split WireArray/PageArray into chunks
<?php
// Thanks to netcarver > https://processwire.com/talk/topic/7803-implement-array-chunk/?p=75573
$items = $pages->find('#whatever'); // Find your stuff
$parts = 3; // How many items should there be in 1 chunk?
$chunked = array_chunk($items->getArray(), $parts);
foreach ($chunked as $chunk) {
foreach ($chunk as $item) {
@yatil
yatil / wcag-ids.md
Created January 10, 2019 09:05
ID changes from WCAG 2.0 to 2.1
  • Perceivable
    • Text Alternatives

      • Non-text Content
        • WCAG 2.0 ID: text-equiv-all
        • WCAG 2.1 ID: non-text-content
    • Time-based Media

      • Audio-only and Video-only (Prerecorded)
        • WCAG 2.0 ID: media-equiv-av-only-alt
  • WCAG 2.1 ID: audio-only-and-video-only-prerecorded
@starckio
starckio / blueprints--contact.yml
Last active February 8, 2019 21:56 — forked from bastianallgeier/controllers--contact.php
Plain contactform example for Kirby 2
title: Contact
pages: false
fields:
title:
label: Page
type: text
width: 1/4
subtitle:
label: Title
type: text
@Heydon
Heydon / observe.js
Last active December 18, 2020 11:52
// Elements with `data-observe` toggle `data-visible`
// between `true` and `false`
if ('IntersectionObserver' in window) {
const callback = (entries, observer) => {
entries.forEach(entry => {
entry.target.setAttribute('data-visible', entry.isIntersecting)
})
}
@PhilippSoehnlein
PhilippSoehnlein / demo.js
Created August 20, 2017 17:14
Lazy loading images with Intersection Observer
/**
* A simple demo on how the new Intersection Observer API can be used to lazy load images.
* https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
*
* Intersection Observer is available in most modern browsers and there's a decent polyfill, too:
* https://github.com/WICG/IntersectionObserver/tree/gh-pages/polyfill
*/
let imageNodes = [];
@LucaRosaldi
LucaRosaldi / get-browser-language-code.php
Last active February 24, 2022 10:13
PHP: Get Browser Language, optionally passing a list of available languages.
<?php
/**
* Get browser language, optionally passing a list of available languages.
*
* @param [array] $available_languages Available languages for the site
* @param [string] $default Default language for the site
* @return [string] Language code
*/
function get_browser_language_code( $available_languages = [], $default = 'en' ) : string
{