Skip to content

Instantly share code, notes, and snippets.

Jan Koch jan-koch

Block or report user

Report or block jan-koch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jan-koch
jan-koch / Jenkinsfile
Created Oct 9, 2019
An example Jenkinsfile that stops deployment if your method complexity is above 20, based on the static code analysis of PHPloc.
View Jenkinsfile
pipeline {
agent any
tools {
ant 'ant'
}
// Pull the repo first.
stages {
stage( 'Checkout Repo' ) {
@jan-koch
jan-koch / phploy.ini
Created Sep 12, 2019
Module 2. Example of a phploy.ini file you can customize for your own needs. This file goes into the root of the folder you want to automatically deploy.
View phploy.ini
; This is a sample phploy.ini file. You can specify as many
; servers as you need and use normal or quickmode configuration.
;
; NOTE: If a value in the .ini file contains any non-alphanumeric
; characters it needs to be enclosed in double-quotes (").
; The server names in the brackets need to match the server names
; you reference in your Jenkinsfile.
[production]
@jan-koch
jan-koch / commands.sh
Created Sep 12, 2019
Commands for Module 2. These commands need to be executed in the folder you want to automatically deploy.
View commands.sh
// Install PHPloy in your project
composer require "banago/phploy"
// Initialize PHPloy in the project folder
phploy --init
@jan-koch
jan-koch / Commands for Module 3
Last active Sep 11, 2019
Commands to install Jenkins on a Ubuntu 18.04 droplet in Digital Ocean. (Run as root)
View Commands for Module 3
// First add the repository key to the system.
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
// Append the Debian repository to your server's sources.list
sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
// Update your package index
apt update
// Run an upgrade
@jan-koch
jan-koch / Jenkinsfile
Last active Sep 12, 2019
Jenkinsfile for automated deployment with Github and PHPloy
View Jenkinsfile
pipeline {
agent any
// Pull the repo first.
stages {
stage( 'Checkout Repo' ) {
steps {
checkout scm
}
}
stage( 'Deploy' ) {
@jan-koch
jan-koch / docker-compose.yml
Created Jun 8, 2019
Example of a docker-compose file to create a local WordPress development setup with Docker.
View docker-compose.yml
version: '3.2'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: on-failure
environment:
# Grab this data from wp-config.php
# TODO: Update DB_HOST in wp-config.php to "db:port"
@jan-koch
jan-koch / export_database_with_replace.sh
Created Jun 8, 2019
Bash script to export a database from a WordPress container and perform a search/replace using the UNIX command "sed". Script is based on https://hub.docker.com/r/jankoch/wordpress.
View export_database_with_replace.sh
#! /bin/bash
CONTAINER=$1
SEARCH=$2
REPLACE=$3
# Dump the file
DUMP=$(docker exec $CONTAINER wp db export --add-drop-table --porcelain)
@jan-koch
jan-koch / git-create-repo.sh
Last active May 24, 2019
A simple bash script to create a repository from the console. Be sure to replace "USERNAME" with your Github user name. This script utilizes nodegh.io.
View git-create-repo.sh
#! /usr/bin/bash
NAME=$1
TYPE=$2
echo "Creating the repository"
gh re --browser false --new "$NAME" --type "$TYPE"
mkdir "$NAME"
cd "$NAME"
@jan-koch
jan-koch / git-create-repo.sh
Created May 22, 2019
A simple bash script to create a repository from the console.
View git-create-repo.sh
#! /usr/bin/bash
NAME=$1
TYPE=$2
echo "Creating the repository"
gh re --browser false --new "$NAME" --type "$TYPE"
mkdir "$NAME"
cd "$NAME"
@jan-koch
jan-koch / functions.php
Created Apr 9, 2019
Remove comments from the single post layout in the WP Astra theme. This snippet goes into your functions.php.
View functions.php
// Remove the default comments from Astra.
add_action(
'init',
function() {
if ( class_exists( 'Astra_Loop' ) ) {
remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_comments' ), 15 );
}
},
11
);
You can’t perform that action at this time.