Skip to content

Instantly share code, notes, and snippets.

View mjot's full-sized avatar

Martin Jäcke mjot

View GitHub Profile
@Oceas
Oceas / wds-hello-world.php
Last active June 2, 2023 10:03
WDS WP-CLI 101 Complete
<?php
/*
Plugin Name: WDS Hello World
Plugin URI: https://webdevstudios.com/
Description: Teaching the basics of WP-CLI
Author: Web Dev Studios
Version: 1.0.0
Author URI: https://webdevstudios.com/
*/
class WDS_CLI {
@psaikali
psaikali / acf-gravity-forms-field.php
Created January 4, 2019 13:43
Populate ACF select field options with Gravity Forms to select a specific form
<?php
/**
* Populate ACF select field options with Gravity Forms forms
*/
function acf_populate_gf_forms_ids( $field ) {
if ( class_exists( 'GFFormsModel' ) ) {
$choices = [];
foreach ( \GFFormsModel::get_forms() as $form ) {
$choices[ $form->id ] = $form->title;
@MaximeCulea
MaximeCulea / wp-cli-ms-cheatset.php
Last active January 9, 2024 19:29
A list of WordPress WP Cli commands when into Multisite usage.
#!/usr/bin/env bash
# Related to WP CLI as single site, check following link
# @see https://gist.github.com/MaximeCulea/dbd5835a01d2b4e6a6544919db3f26a0
# All wp cli comands will be declared both (as much as possible) :
# - with xargs (not all servers support xargs)
# - more native shell syntax "for in"
# WP Crons MS
@jaredatch
jaredatch / mailhog-mamp.md
Created January 30, 2018 21:57
Install MailHog with MAMP Pro

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update
@kstover
kstover / customDatePicker.js
Last active February 2, 2024 10:06
Customising Ninja Forms date picker field
/*
* When our date picker loads, we want to modify some of picker settings.
*
* We want to:
* 1) Modify our month labels with a different string.
* 2) Disable specific dates so that they can't be selected.
*
*
* This object will listen to date pickers as they initialize so that we can modify settings.
*/
<?php
/*
Plugin Name: UTF8mb4-convert
Version: 1.0
*/
function update_db_to_utf8mb4() {
if ( ! isset( $_GET['update-utf8bm4'] ) ) {
return;
}
@shyim
shyim / ShyimCron.php
Created October 4, 2016 12:09
Simple Cron in Shopware 5.2 Pluginsystem
<?php
namespace ShyimCron;
use Shopware\Components\Plugin;
use Shopware\Components\Plugin\Context\InstallContext;
use Shopware\Components\Plugin\Context\UninstallContext;
class ShyimCron extends Plugin {
public static function getSubscribedEvents()
@kellenmace
kellenmace / add-unfiltered_html-capability-to-admins-or-editors.php
Last active June 19, 2024 13:50
Add unfiltered_html Capability to Admins or Editors in WordPress Multisite
<?php
/**
* Enable unfiltered_html capability for Editors.
*
* @param array $caps The user's capabilities.
* @param string $cap Capability name.
* @param int $user_id The user ID.
* @return array $caps The user's capabilities, with 'unfiltered_html' potentially added.
*/
@stefanmaric
stefanmaric / copy-to-clipboard-bookmarklet.md
Created September 7, 2016 20:54
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
@philfreo
philfreo / _README.md
Last active April 8, 2018 06:42
Make Dash button play iTunes to AirPlay speakers

Uses a (basically free) Amazon Dash Button to play/pause your iTunes music over AirPlay speakers.

Requires OS X and an AirPlay compatible speaker (e.g. Apple TV or any speaker hooked up to AirPort Express).

  1. Install node-dash-button and follow the instructions to get your Dash Button's MAC address.
  2. Install node-applescript
  3. Tweak code as desired, filling in your button's MAC address, name of your AirPlay speakers, etc.
  4. Run via Terminal: node dash_buttons.js