Skip to content

Instantly share code, notes, and snippets.

View DimaMinka's full-sized avatar
💻
CDK Computers - Modern Web Development

Dima Minka DimaMinka

💻
CDK Computers - Modern Web Development
View GitHub Profile
// https://developers.cloudflare.com/workers/about/
// https://tutorial.cloudflareworkers.com
//
// A Service Worker which adds Security Headers.
// Checks:
// https://securityheaders.io/
// https://observatory.mozilla.org/
// https://csp-evaluator.withgoogle.com/
// https://hstspreload.org/
// https://www.ssllabs.com/ssltest/
@klipitkas
klipitkas / permfix-wp.sh
Created August 17, 2018 07:31
WordPress permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER="$1" # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
@ethicka
ethicka / sage9-deploybot.md
Last active May 4, 2020 07:24
How to build and deploy a Roots / Sage 9 WordPress theme on Deploybot

Deploying Roots Sage 9 via Deploybot

Sage 9 is the latest and greatest from Roots, but the build process is much more complicated than Sage 8 (i.e. gulp --production and profit). The following took me quite a bit of time to figure out, but is probably not comprehensive. Please comment if you need clarity. I hope it saves you some time!

Build the Container

Deploybot allows you to create your own containers. Go to Settings > Containers > Create a container. Based off the Ubuntu 16.04 container add the following build commands and save as Sage 9:

@mtigdemir
mtigdemir / bitbucket-pipelines.yml
Last active February 20, 2023 09:24
Deployer Bitbucket Pipeline
image: mtigdemir/php-deployer-pipeline
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- composer install
@gemmadlou
gemmadlou / 01-introduction.md
Last active May 3, 2024 06:38
WordPress Composer Starter (Steps)

Develop WordPress as a Modern PHP Project with Composer


WordPress is popular because it's easy to setup without much technical know-how. However, to build a more robust PHP project with command line deployments, updates and ongoing maintenance, working with WordPress out-of-the-box raises specific challenges:


  • How can we make our WordPress projects portable between developers?
@zevilz
zevilz / wp_register_cpt_with_tax.php
Last active July 23, 2018 05:49
Register custom post type with custom taxonomy for wordpress. Post type link include taxonomy term.
<?php
/*
*
* Register post type "service"
*
*/
add_action('init', 'register_service', 0);
function register_service() {
register_post_type('service', [
'label' => null,
@aiiddqd
aiiddqd / snippet.php
Created December 18, 2017 09:31
If isset cookie - clear value and redirect to url - WordPress.
<?php
/**
* If isset cookie - clear value and redirect to url
*/
function redirect_after_signin(){
if(is_user_logged_in()){
if( ! empty($_COOKIE["redirect_url_sso"])){
$url = $_COOKIE["redirect_url_sso"];
setcookie("redirect_url_sso", "", time() - 3600);
@aiiddqd
aiiddqd / php
Created November 14, 2017 19:15
Use HTTPS for some sites of network
<?php
/**
* Use HTTPS for some sites of network
*/
function rsssl_check_protocol_multisite($url, $scheme, $orig_scheme){
if(get_current_blog_id() == 23){
$url = str_replace("http://", "https://", $url);
@karlhillx
karlhillx / macos_high_sierra_apache_php_brew_2018.md
Last active March 13, 2024 02:42
macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

Homebrew Installation

First let's install Homebrew.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

#!/usr/bin/env bash
#
# WPDistillery setup file
#
# Author: Flurin Dürst
# URL: https://wpdistillery.org
#
# File version 1.7.1.HF
# WP-CLI/PHP-distro Hotfix related to https://github.com/flurinduerst/WPDistillery/issues/56