Skip to content

Instantly share code, notes, and snippets.

View nlenkowski's full-sized avatar

Nathan Lenkowski nlenkowski

View GitHub Profile
@polevaultweb
polevaultweb / acf_pro_license_constant.php
Last active March 22, 2023 03:06
Define the Advanced Custom Fields Pro license key with a constant
<?php
function my_filter_acf_pro_license_option( $pre ) {
if ( ! defined( 'ACF_PRO_LICENSE' ) || empty( ACF_PRO_LICENSE ) ) {
return $pre;
}
$data = array(
'key' => ACF_PRO_LICENSE,
'url' => home_url(),
@bgarrant
bgarrant / ValetSwitchPHP.md
Last active September 30, 2022 08:08
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt
@nickdenardis
nickdenardis / deploy.php
Last active February 13, 2024 16:39
Zero downtime local build Laravel 5 deploys with Deployer
<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'vendor/deployer/recipes/local.php';
require 'vendor/deployer/recipes/rsync.php';
require 'vendor/deployer/recipes/npm.php';
// Configuration
set('ssh_type', 'native');
@daltonrooney
daltonrooney / acf-migrate-db-pro.php
Last active October 27, 2020 04:34
Prevent ACF Pro license key from being overwritten during WP Migrate DB Pro migration
<?php
/*
Based on http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
*/
class ACF_WP_Migrate_DB_Pro_Tweaks {
function __construct() {
add_filter( 'wpmdb_preserved_options', array( $this, 'preserved_options' ) );
}
@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@jacobdubail
jacobdubail / php
Created January 30, 2017 23:44
Function to auto-set your ACF5 Pro license key
function jtd_acf_auto_set_license_keys() {
if ( !get_option('acf_pro_license') && defined('ACF_5_KEY') ) {
$save = array(
'key' => ACF_5_KEY,
'url' => home_url()
);
$save = maybe_serialize($save);
@pdanford
pdanford / README.md
Last active April 13, 2024 18:19
Launching iTerm2 from macOS Finder

Launching iTerm2 from macOS Finder

(Based on info from Peter Downs' gitub but with modified behavior to open a new terminal window for each invocation instead of reusing an already open window.)

The following three ways to launch an iTerm2 window from Finder have been tested on iTerm2 version 3+ running on macOS Mojave+.

pdanford - April 2020


@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@plasticbrain
plasticbrain / gulpfile.js
Last active February 13, 2024 14:31
gulp.js task to deploy code to remote servers
/*******************************************************************************
* Description:
*
* Gulp file to push changes to remote servers (eg: staging/production)
*
* Usage:
*
* gulp deploy --target
*
* Examples:
@mattradford
mattradford / licence activation.php
Last active October 28, 2023 19:25
ACF5 Pro licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.
// Place this in wp-config
define( 'ACF_5_KEY', 'yourkeyhere' );
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function auto_set_license_keys() {
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) {
$save = array(
'key' => ACF_5_KEY,