Skip to content

Instantly share code, notes, and snippets.

View AndreKelling's full-sized avatar

André J. Kelling AndreKelling

View GitHub Profile
@AndreKelling
AndreKelling / relay-price-validation.php
Last active May 2, 2023 06:51
ACF Repeater validator for relay prices
<?php
/**
* based on https://gist.github.com/sudarshann/66c55e48f1e36fb5412261d869976dc7
*
* sorry for german wordings inside!
*/
class AndrekellingthemeAcfValidateStaffelpreis {
public function __construct() {
add_filter('acf/validate_value/name=prices', [$this, 'acf_validate_staffelpreis'], 10, 4);
}
@AndreKelling
AndreKelling / isMouseUser.js
Created February 26, 2020 14:20
isMouseUser
isMouseUser: function() {
// just presumpt that an IE11 user is a mouse user
var isIE11 = !!window.msCrypto;
return (matchMedia('(pointer:fine)').matches || isIE11);
},
@AndreKelling
AndreKelling / gulpfile.js
Created August 9, 2019 07:34
berlinstudios gulpfile with browserify and babel
'use strict';
const gulp = require('gulp');
const minifycss = require('gulp-clean-css');
const concat = require('gulp-concat');
const autoprefixer = require('gulp-autoprefixer');
const browserSync = require('browser-sync').create();
const sass = require('gulp-sass');
const browserify = require('browserify');
const imagemin = require('gulp-imagemin');
const newer = require('gulp-newer');
@AndreKelling
AndreKelling / nested-ampersand.scss
Created April 11, 2019 07:41
Nested Ampersand Sample
.nested-item {
$this: &;
&__wrapper {
display: flex;
}
&__title {
padding-bottom: 10px;
}
@AndreKelling
AndreKelling / app.js
Created March 15, 2019 11:27
random image | lazyload with srcset | currently jpg only
// initialise example
import randomImage from './module/randomImage';
randomImage();
@AndreKelling
AndreKelling / brew mysql commands
Created March 13, 2019 09:29
homebrew mysql mojave
# other fine brew commands regarding mysql service
mysql.server start
mysql.server stop
# don't really get the difference between before commands
# https://stackoverflow.com/questions/43418955/difference-between-brew-services-start-mysql-and-mysql-server-start
brew services start [email protected]
brew services stop [email protected]
@AndreKelling
AndreKelling / objectFitFix.js
Last active October 1, 2019 15:53
CSS object-fit to background-image fallback // IE11
// Detect objectFit support
// set full size img to selected container as background
// especially for IE11
module.exports = () => {
if ('objectFit' in document.documentElement.style === false) {
// assign HTMLCollection with parents of images with objectFit to variable
const container = document.getElementsByClassName('js-sliderImg');
// Loop through HTMLCollection
@AndreKelling
AndreKelling / brew config
Last active March 6, 2019 07:29
brew issue - stuck on downloading anything
HOMEBREW_VERSION: 2.0.3
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 6865aee729ebc28dfa4af6fdbaeec297df0ac34c
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 7149a5627db44fcbdcc4eb38c4ef90748f85c5b9
Core tap last commit: 17 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.Q7rQX3M3R1/org.macosforge.xquartz:0
HOMEBREW_LOGS: /Users/mac/Library/Logs/Homebrew
@AndreKelling
AndreKelling / fetchXMLtoJSON.php
Created March 1, 2019 14:27
fetch XML doc from URL and ecnode to json file in build dir
<?php
// fetch XML doc from URL and ecnode to json file in build dir
$jobsUrl = "https://xml-source";
$fileName = "jobs.json";
$fileDist = __DIR__."/../build/".$fileName;
function get_content($URL){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
@AndreKelling
AndreKelling / header-parallax.js
Created November 8, 2018 13:52
for vertical centred background-image on #masthead
var timeout;
window.addEventListener('scroll', function () {
// If there's a timer, cancel it
if (timeout) {
window.cancelAnimationFrame(timeout);
}
timeout = window.requestAnimationFrame(function () {