Skip to content

Instantly share code, notes, and snippets.

View Blackbam's full-sized avatar

David Stöckl Blackbam

View GitHub Profile
@Blackbam
Blackbam / EnoreAssetPathResolver.php
Created April 29, 2021 12:48
Webpack Encore standalone as a single file
<?php
// Original Source: https://github.com/bpolaszek/webpack-encore-resolver
// ... but as a single file to include in your application
namespace Namespace; \\ replace with your namespace
final class EncoreAssetPathResolver
{
/**
* @var string
@Blackbam
Blackbam / demo.html
Created February 22, 2021 14:58 — forked from dave-kennedy/demo.html
Flyout menus for Bootstrap 4
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Bootstrap flyout demo</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="flyout.css" rel="stylesheet">
</head>
<body>
@Blackbam
Blackbam / Dockerfile
Created September 3, 2019 14:40
Docker php7.3-fpm with basic libs
FROM php:7.3-fpm
# install git
RUN apt-get update && \
apt-get install -y --no-install-recommends git
#install some base extensions
RUN apt-get install -y \
g++ \
git \
@Blackbam
Blackbam / extvideo-embed-code.php
Created May 28, 2019 15:30
Website: Embed external videos by URL from Youtube and Vimeo (PHP, Javascript, HTML)
/**
*
* @param $url
* @return bool|string
*/
function extvideo_embed_code($url) {
if(filter_var($url, FILTER_VALIDATE_URL)) {
$parsed = parse_url($url);
if (in_array($parsed["host"], ["youtube.com", "www.youtube.com", "youtu.be"])) {
if (preg_match('/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/', $url, $matches)) {
@Blackbam
Blackbam / nav-menu-item-custom-fields.php
Created June 18, 2017 23:50 — forked from kucrut/nav-menu-item-custom-fields.php
Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
<?php
/**
* Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
* @author Weston Ruter (@westonruter), X-Team
*/
add_action( 'init', array( 'XTeam_Nav_Menu_Item_Custom_Fields', 'setup' ) );
class XTeam_Nav_Menu_Item_Custom_Fields {
static $options = array(