Skip to content

Instantly share code, notes, and snippets.

View AndreKelling's full-sized avatar

André J. Kelling AndreKelling

View GitHub Profile
@AndreKelling
AndreKelling / tools.css
Last active March 7, 2018 10:19
css tools / getting obsolete more and more...
/*--------------------------------------------------------------
# Tools
--------------------------------------------------------------*/
.animation {transition:all 300ms ease-in-out;}
.clickable { cursor:pointer; }
.fleft { float: left }
.fright { float: right }
.tleft { text-align: left }
.tright { text-align: right }
.centered {text-align: center}
@AndreKelling
AndreKelling / togglebutton.js
Last active April 25, 2018 19:24
toggle button jquery + js module
// jquery
var allToggleContents = $('.toggle_content').hide();
$('.toggle_handler').click(function() {
toggleControl($(this));
});
function toggleControl(button) {
var container = $("#"+button.attr('aria-controls'));
@AndreKelling
AndreKelling / config-global.js
Last active July 17, 2018 09:07
jQuery / Parsley / Config
document.ParsleyConfig = {
excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden, .parsley-novalidate',
errorsWrapper: '<ul class="parsley-errors-list" role="alert"></ul>',
trigger: 'change focusout',
triggerAfterFailure: 'change focusout'
};
@AndreKelling
AndreKelling / on-resize.js
Last active July 17, 2018 09:06
On Resize
var resizeTimer;
$(window).on('resize', function(e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
console.log('i had resized')
}, 250);
});
@AndreKelling
AndreKelling / template-mail.php
Last active July 17, 2018 09:45
Wordpress / Contact Form 7 / Hook to wrap Header and Footer Templates around eMail HTML message body
<?php
/**
* Displays mail template parts header and footer
*/
add_action( 'wpcf7_before_send_mail', 'wpcf7_add_text_to_mail_body' );
function wpcf7_add_text_to_mail_body($contact_form){
// get mail property
@AndreKelling
AndreKelling / module-pattern.js
Created July 25, 2018 07:55
module pattern example with jquery
'use strict';
var $ = require('jquery');
var Product = (function($) {
var plugin = {};
var settings = {
stickyBasket: '[data-sticky-basket]',
quickLinks: '.product__quicklinks-list li a',
@AndreKelling
AndreKelling / readMore.js
Last active August 29, 2018 06:52
jQuery readMore reveal
/*
* use like:
* <p data-readmore="fazit" data-readmore-maxlines="3">bla bla long text...</p>
* <div data-readmore-toggle="fazit" class="fs-smaller clickable clr-blue">...more</div>
*
* while `data-readmore` activates the functionality and `fazit` works as selector id for the toggle `data-readmore-toggle`.
* activator and toggle need to be in the same parent container!
*/
'use strict';
// add in local config for fine debug display.
// use like php var_dump($var) >> wp_dump($var)
define( 'WP_DEBUG', true );
function wp_dump($variable,$die=false){
echo '<pre>'.print_r($variable, true).'</pre>';
if($die) die();
}
@AndreKelling
AndreKelling / .stylelintrc
Last active September 14, 2018 07:25
basic stylelint file
{
"rules": {
"color-no-invalid-hex": true,
"font-family-name-quotes": "always-where-recommended",
"font-family-no-duplicate-names": true,
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "never-multi-line",
"function-comma-newline-before": "never-multi-line",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
@AndreKelling
AndreKelling / richtext-render.php
Last active November 24, 2018 09:19
Dynamic Gutenberg WP Block RichText Component Rendering (until Gutenberg 4.5.1)
<?php
/**
* help rendering the richText Component saved object
* was needed when RichText saved as array. Since Gutenberg 4.5.1. RichText saves in string!
*
* no dynamic nice rendering provided https://github.com/WordPress/gutenberg/projects/14#card-11206239
*
* @since x.x.x
* @param $arr object from the JS RichText Component