Skip to content

Instantly share code, notes, and snippets.

View dmhendricks's full-sized avatar

Daniel M. Hendricks dmhendricks

View GitHub Profile
@cloudcreatordotio
cloudcreatordotio / php-pools.md
Created November 18, 2019 22:12 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@dmhendricks
dmhendricks / index.html
Last active August 6, 2021 21:28
HTML 5 Boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Boilerplate</title>
<meta name="description" content="Boilerplate" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="canonical" href="https://example.com/" />
@lynt-smitka
lynt-smitka / .htaccess
Last active August 12, 2024 09:18
Block hidden files except .well-known - Apache .htaccess + Nginx
RewriteRule "(^|/)\.(?!well-known\/)" - [F]
@excid3
excid3 / dynamic-nginx-module-ubuntu-18.04.sh
Created June 20, 2018 17:58
How to compile a dynamic nginx module for Ubuntu 18.04
# Install dependencies that nginx was originally compiled with
sudo apt install libperl-dev libgeoip-dev libgd-dev
# Get the nginx source
wget https://nginx.org/download/nginx-1.14.0.tar.gz
tar zxf nginx-1.14.0.tar.gz
# Get the module source
wget https://github.com/fdintino/nginx-upload-module/archive/master.zip
unzip master.zip
@ahmadawais
ahmadawais / flywheel-local-xdebug-vscode.md
Last active September 5, 2024 01:57
Debug WordPress with Visual Studio Code | VSCode WordPress Debug Setup | WordPress xDebug Setup for Local by FlyWheel with VSCode | Part of the VSCode Learning Course → https://VSCode.pro

VSCode WordPress Debugging Setup: WordPress Xdebug Setup for Local by FlyWheel with VSCode


Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User

🚅 TL;DR

  • Make sure your Local by FlyWheel WordPress install is a custom install
@ann71727
ann71727 / WordPress-WP_Query-result-posts-object-to-an-array.php
Last active July 6, 2023 10:42
WordPress WP_Query() result posts object to an array
<?php
/*
* Convert Object To Array
* https://v123.tw
*/
$args = array(
'showposts' => -1,
'post_type' => 'post',
'post_status' => 'publish'
@jpickwell
jpickwell / install-redis.sh
Last active May 14, 2024 07:38 — forked from khelll/install-redis.sh
Installing Redis 5.0.0 on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=5.0.0
@luciopaiva
luciopaiva / _Full-socketio-client-and-server-example.md
Last active August 20, 2024 05:17
Full socket.io client and server example

Full socket.io client and server example

Last updated: 2021-02-21, tested with socket.io v3.1.1

This is the simplest implementation you will find for a client/server WebSockets architecture using socket.io.

To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.

If you're looking for examples using frameworks, check these links:

@snapeuh
snapeuh / wp-config.php
Created October 11, 2016 14:00
Use WordPress with a dynamic domain
<?php
define('SP_REQUEST_URL', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', SP_REQUEST_URL);
define('WP_HOME', SP_REQUEST_URL);
@kellenmace
kellenmace / get-file-type-url-remote-file-wordpress.php
Created September 9, 2016 18:07
Get File Type by URL for a Remote File in WordPress
<?php
/**
* Get the file mime type for a file by its URL.
*
* @param $url The URL to the file.
* @return The file mime type or empty string on failure.
*/
function km_get_file_type_by_url( $url ) {