Skip to content

Instantly share code, notes, and snippets.

View ekandreas's full-sized avatar

Andreas Ek ekandreas

View GitHub Profile
@ekandreas
ekandreas / bladerunner-view-plugin.php
Created December 20, 2021 19:59
Bladerunner View Plugin with BladeOne
<?php
/*
Plugin Name: Bladerunner View
Description: Replace Bladerunner with new blade view compiler
Version: 1.0.0
Author: EkAndreas
License: MIT License
*/
function bladeViewPaths()
@ekandreas
ekandreas / .dockerignore
Last active January 29, 2021 00:31
Dockerize Roots Bedrock WP w ES
vendor
dist
web/app/mu-plugins/*/
!web/app/mu-plugins/bedrock-autoloader.php
!web/app/mu-plugins/disallow-indexing.php
!web/app/mu-plugins/register-theme-directory.php
web/app/plugins/*/
web/wp
web/app/db.php
@ekandreas
ekandreas / fix-fugly-filenames-frozzare.php
Created March 21, 2019 10:02
fixa fula filnamn wordpress frozzare style
<?php
add_filter( 'wp_handle_upload_prefilter', function ( $file ) {
if ( ! is_array( $file ) && ! is_string( $file ) ) {
return $file;
}
if ( ! is_array( $file ) ) {
$file = [
'name' => $file,
];
@ekandreas
ekandreas / Vagrantfile
Last active December 16, 2018 17:31 — forked from lizrice/Vagrantfile
Vagrant file for setting up a single-node Kubernetes cluster that I can access from my desktop. Read more: https://medium.com/@lizrice/kubernetes-in-vagrant-with-kubeadm-21979ded6c63
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This script to install Kubernetes will get executed after we have provisioned the box
$script = <<-SCRIPT
# Install kubernetes
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
@ekandreas
ekandreas / autoload.php
Last active October 17, 2018 17:07
Legacy autoload example
<?php
/*
* Legacy autoload example
*/
spl_autoload_register(function ($requestedClass) {
$baseClass='ElseifAB\\Regnradar';
if (0!=strpos($requestedClass, $baseClass.'\\', 0)) {
return false;
}
@ekandreas
ekandreas / deploy.php
Last active August 16, 2018 13:10
Ultimate WordPress PHP deployer file for Swedish site
<?php
namespace Deployer;
require 'recipe/composer.php';
set('repository', 'path-to-repo');
set('git_tty', true);
set('shared_files', ['.env','web/.htaccess']);
set('shared_dirs', ['web/app/uploads']);
@ekandreas
ekandreas / nginx
Last active April 21, 2018 12:40
nginx-laravel-forge
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/mwb.digital/before/*;
#ADDED
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MWBROOT:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
#/ADDED
server {
listen 443 ssl http2;
@ekandreas
ekandreas / deploy-languages.php
Created February 12, 2018 10:54
PHP Deployer script to add language support for WordPress installations
<?php
/**
* Install WordPress languages after php deployer deploy.
* Please, set wp_languages as array with language codes!
* Support added for local development environment
*/
namespace Deployer;
use Deployer\Task\Context;
@ekandreas
ekandreas / model_post_latest.php
Created November 17, 2017 16:43
Vanilla Model Post
function model_post_latest($post_type = 'post', $max = 5)
{
return get_posts([
'post_type' => $post_type,
'posts_per_page' => $max,
]);
}
@ekandreas
ekandreas / functions.php
Created August 27, 2017 09:32
Add blade controllers and views to a mother theme
add_filter('bladerunner/controller/paths', function ($paths) {
$paths = get_template_directory() . '/controllers';
return $paths;
});
add_filter('bladerunner/template/bladepath', function($paths) {
$paths = get_template_directory() . '/views';
return $paths;
});