Skip to content

Instantly share code, notes, and snippets.

View florianbrinkmann's full-sized avatar

Florian Brinkmann florianbrinkmann

View GitHub Profile
@florianbrinkmann
florianbrinkmann / index.js
Last active May 17, 2020 15:40
Set attribute `maxWidth` for inner blocks of `slug/slider` block depending on block position in the editor. https://florianbrinkmann.com/block-attribute-abhaengig-block-position-11307/
const {
select,
} = wp.data;
wp.domReady( () => {
/**
* Get the slider blocks.
*
* @param {object} block
* @param {array} sliderBlocks
/**
* Add categories attribute to core/latest-posts block.
*
* @param {*} settings
* @param {*} name
*/
function latestPostsCategories( settings, name ) {
// Only modify latest posts block settings.
if ( name !== 'core/latest-posts' ) {
return settings;
@florianbrinkmann
florianbrinkmann / dropcap.js
Last active September 4, 2018 00:10
Modified version of Adobe’s dropcap.js (https://github.com/adobe-webplatform/dropcap.js) to make it responsive
/*
Copyright 2014 Adobe Systems Incorporated. Licensed under the Apache 2.0 License.
http://www.apache.org/licenses/LICENSE-2.0.html
*/
(function () {
"use strict";
// Reference terms: http://blogs.wayne.edu/bcam/wp-content/blogs.dir/308/files/2013/09/glyphterms.gif
import classnames from 'classnames';
import { textColors, backgroundColors } from '../colors';
const {
registerBlockType,
} = wp.blocks;
const {
InspectorControls,
InnerBlocks,
@florianbrinkmann
florianbrinkmann / functions.php
Created May 2, 2018 15:00
Remove lightbox script from Hannover WordPress theme.
<?php
add_action( 'wp_enqueue_scripts', 'hannover_child_remove_lightbox', 100 );
/**
* Remove the Hannover lightbox script.
*/
function hannover_child_remove_lightbox() {
wp_dequeue_script( 'hannover-lightbox' );
wp_deregister_script( 'hannover-lightbox' );
}
@florianbrinkmann
florianbrinkmann / lazy-loader-spinner.css
Last active February 22, 2018 14:06
Add spinner to images that are currently loaded by lazysizes
/* Spinner SVG by Sam Herbert (https://github.com/SamHerbert/SVG-Loaders), published under the MIT License */
.lazyloading {
color: transparent;
opacity: 1;
transition: opacity 300ms;
background: url("data:image/svg+xml,%3Csvg width='44' height='44' xmlns='http://www.w3.org/2000/svg' stroke='%23333'%3E%3Cg fill='none' fill-rule='evenodd' stroke-width='2'%3E%3Ccircle cx='22' cy='22' r='1'%3E%3Canimate attributeName='r' begin='0s' dur='1.8s' values='1; 20' calcMode='spline' keyTimes='0; 1' keySplines='0.165, 0.84, 0.44, 1' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-opacity' begin='0s' dur='1.8s' values='1; 0' calcMode='spline' keyTimes='0; 1' keySplines='0.3, 0.61, 0.355, 1' repeatCount='indefinite'/%3E%3C/circle%3E%3Ccircle cx='22' cy='22' r='1'%3E%3Canimate attributeName='r' begin='-0.9s' dur='1.8s' values='1; 20' calcMode='spline' keyTimes='0; 1' keySplines='0.165, 0.84, 0.44, 1' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-opacity' begin='-0.9s' dur='1.8s' values='1
@florianbrinkmann
florianbrinkmann / style.css
Last active December 26, 2017 14:59
Child theme stylesheet for rindby theme
/*
Theme Name: Rindby Child
Theme URI: https://florianbrinkmann.com/en/wordpress-themes/rindby/
Author: Florian Brinkmann
Description: Child theme for Rindby.
Version: 1.0.0
Template: rindby
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@florianbrinkmann
florianbrinkmann / custom-tinymce-button.js
Last active June 27, 2017 14:24
Code to add a custom button to the TinyMCE editor (needs WordPress 4.8)
/**
* Listen to setup of a TinyMCE instance.
*/
jQuery(document).on('tinymce-editor-setup', function (event, editor) {
/**
* Add the id of the soon-to-create button to the
* toolbar1.
*
* @type {string}
*/

Keybase proof

I hereby claim:

  • I am florianbrinkmann on github.
  • I am florianbrinkmann (https://keybase.io/florianbrinkmann) on keybase.
  • I have a public key whose fingerprint is 1BA6 7B53 EE82 8489 0CEA 0EB7 9C4A 410F 7E81 845E

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.