Skip to content

Instantly share code, notes, and snippets.

View benjaminpick's full-sized avatar

Benjamin Pick benjaminpick

View GitHub Profile
@benjaminpick
benjaminpick / docker-compose.yml
Created March 28, 2017 17:20
PHP / MySQL combo
server:
mem_limit: 301m
image: webgriffe/docker-php-apache-base:latest
links:
- wordpress_db
ports:
- "80:80"
volumes:
- .:/var/www/html
environment:
@benjaminpick
benjaminpick / FrontendUriBuilderUtility.php
Last active January 13, 2021 14:17
Creating Frontend URLs in Typo3 without URIBuilder
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class FrontendUriBuilder for creating a frontend link in the backend
* @package PDVSysteme\Pdvsupportbase\Util
* @see https://stackoverflow.com/questions/33751570/typo3-with-extbase-uribuilder-or-something-similar-in-backend-hook
* @license Public Domain
*/
@benjaminpick
benjaminpick / SendMailService.php
Last active March 18, 2019 19:22
Abort sending Email
<?php
namespace In2code\Powermailextended\Domain\Service;
use In2code\Powermail\Domain\Service\Mail\SendMailService as SendMailServicePowermail;
class SendMailService {
public function manipulateMail($message, &$email, SendMailServicePowermail $sendMailService) {
if ($email['template'] == 'Mail/OptinMail' && $email['subject'] == 'subject line') {
// Never send such Optin mails ...
@benjaminpick
benjaminpick / camel_case.php
Last active April 11, 2019 18:46
CamelCase
<?php
function underscoreToCamelCase($string)
{
$str = str_replace(' ', '', ucwords(str_replace('_', ' ', $string)));
$str = lcfirst($str);
return $str;
}
@benjaminpick
benjaminpick / functions.php
Created June 25, 2019 05:21
Show Bootstap Breakpoint in Admin Bar
<?php
add_action('admin_bar_menu', function ($admin_bar) {
if (!is_admin() && WP_DEBUG) $admin_bar->add_menu([
'id' => 'my-item',
'title' => 'Breakpoint: ' .
'<strong class="d-sm-none">XS</strong>' .
'<strong class="d-none d-sm-inline d-md-none">SM</strong>' .
'<strong class="d-none d-md-inline d-lg-none">MD</strong>' .
'<strong class="d-none d-lg-inline d-xl-none">LG</strong>' .
'<strong class="d-none d-xl-inline">XL</strong>'
@benjaminpick
benjaminpick / Login.php
Last active October 4, 2025 03:53
Instagram Test
<?php
namespace Instagram\Auth;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ClientException;
use Instagram\Exception\InstagramAuthException;
use Instagram\Exception\InstagramException;
use Instagram\Transport\TransportFeed;
@benjaminpick
benjaminpick / frontend.js
Created November 15, 2021 11:03
Beaver Builder: Stop Videos when they are outside of the visible viewport
// By default, videos continue to run even when not visible. This is using unnecessary CPU ressources.
jQuery.fn.isInViewport = function () {
var elementTop = jQuery(this).offset().top;
var elementBottom = elementTop + jQuery(this).outerHeight();
var viewportTop = jQuery(window).scrollTop();
var viewportBottom = viewportTop + jQuery(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;