Skip to content

Instantly share code, notes, and snippets.

View ekandreas's full-sized avatar

Andreas Ek ekandreas

View GitHub Profile
@ekandreas
ekandreas / .dockerignore
Last active February 14, 2024 14:52
Dockerize your WordPress Bedrock
*
!docker.conf
@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 / deploy.php
Last active April 26, 2021 22:04
Deploy example PHP Deployer
<?php
/*** step 1 ***/
date_default_timezone_set('Europe/Stockholm');
/*** step 2 ***/
include_once 'vendor/deployer/deployer/recipe/common.php';
/*** step 3 ***/
server( 'production', 'andreasek.se', 22 )
->env('deploy_path','/mnt/persist/www/aekab.se')
@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 / pull.php
Last active March 10, 2018 11:54
PHP Deployer, Pull script example from production to my local Bedrock/Vagrant environment
<?php
/**
* Pull script example from production to my local Bedrock/Vagrant environment
* Requires PHP Deployer 3
*
* Andreas Ek, 2015-04-23
*/
date_default_timezone_set( 'Europe/Stockholm' );