Skip to content

Instantly share code, notes, and snippets.

<?php
const ACTION_NAME = 'shea_ajax_example';
$handler = function () {
check_ajax_referer( ACTION_NAME );
wp_send_json_success( 'it works!' );
};
@brandonjp
brandonjp / moment-formats.md
Last active May 12, 2024 11:58
List of common date time formats for Moment.js

Big List of Common Moment.JS Date and Time Formats for Easy Copying

Example Format
2021 YYYY
🦏 🦏
202108 YYYYMM
2021-08 YYYY-MM
🦏 🦏
8/5 M/D
08/05 MM/DD
@JayHoltslander
JayHoltslander / deactivate-plugins-on-domain.php
Last active April 25, 2023 18:40 — forked from subharanjanm/deactivate-plugins-wpe-staging.php
Deactivate certain Wordpress plugins when running on the development/staging domain
<?php
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$plugins = array(
'wordpress-seo/wp-seo.php',
'broken-link-checker/broken-link-checker.php'
);
if ( strpos(get_site_url(), 'devserver.com') !== false ) {
deactivate_plugins( $plugins );
}
else {
@jordanamorais
jordanamorais / custom-zsh-apple-touchbar-plugin.md
Last active February 23, 2021 01:33
How to configure custom ZSH Apple Touch Bar

1 - Baixar o repositório do plugin:

git clone https://github.com/floor114/zsh-apple-touchbar $ZSH_CUSTOM/plugins/zsh-apple-touchbar

2 - Entrar na pasta do plugin:

cd $ZSH_CUSTOM/plugins/zsh-apple-touchbar
@dianjuar
dianjuar / How to make a WordPress plugin require another plugin.md
Last active July 18, 2023 19:27
Make a WordPress plugin dependent of another plugin

How to make WordPress a plugin require another plugin?

Put this function on the main php file of your dependent plugin and call it with the rigth parameters.

/**
 * Verify if a plugin is active, if not deactivate the actual plugin an show an error
 * @param  [string]  $my_plugin_name
 *                   The plugin name trying to activate. The name of this plugin
 *                   Ex:
@subharanjanm
subharanjanm / deactivate-plugins-wpe-staging.php
Last active March 19, 2024 19:09
Deactivate certain plugins in the development/staging environment of WP Engine
<?php
/*
Plugin Name: Deactivate Certain Plugins - WPEngine Staging
Plugin URI: https://gist.github.com/subharanjanm/4272d25a446fb2ca12a549a4a5662633
Description: Deactivate certain plugins in the development/staging environment of WP Engine.
Version: 1.0
Author: Subharanjan
Author URI: https://gist.github.com/subharanjanm/4272d25a446fb2ca12a549a4a5662633
License: GPLv2
*/
@bezhermoso
bezhermoso / notification-actions.applescript
Last active February 11, 2023 09:54
Handly AppleScripts to manage OS X notifications. (Use in Automator, bind to keyboard shortcuts via BetterTouchTool, etc.) Inspired by http://apple.stackexchange.com/a/155736
# Close all notifications
my closeNotifications()
on closeNotifications()
tell application "System Events" to tell process "Notification Center"
set theWindows to every window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
try
click button 1 of this_item
set dFolder to "~/Desktop/screencapture/"
do shell script ("mkdir -p " & dFolder)
set i to 0
repeat 960 times
set tTime to do shell script "date +%H%M%S"
do shell script ("screencapture " & dFolder & "frame-" & i & ".png")
delay 30 -- Wait for 30 seconds.
set i to i + 1
@jonobr1
jonobr1 / auto-capture.scpt
Last active March 21, 2024 02:34
A small AppleScript to take a screenshot every 30 seconds for 8 hours. Saves to an Image Sequence in a desktop folder. Great for recording your workday.
set dFolder to "~/Desktop/screencapture/"
do shell script ("mkdir -p " & dFolder)
set i to 0
repeat 960 times
do shell script ("screencapture " & dFolder & "frame-" & i & ".png")
delay 30 -- Wait for 30 seconds.
set i to i + 1
end repeat
@n8henrie
n8henrie / txt_to_reminders.applescript
Last active March 11, 2024 17:04
Demonstration of using AppleScript with Reminders.app
--taken from http://benguild.com/2012/04/11/how-to-import-tasks-to-do-items-into-ios-reminders/#comment-1346894559
--set theFileContents to (read file "Users:n8henrie:Desktop:Reminders.txt") -- Change this to the path to your downloaded text file with your tasks in it! (Note the : instead of a / between folders) Or, just name them Reminders.txt and put them in your downloads folder
--set theLines to paragraphs of theFileContents
set theLines to {"task name 1", "task name 2"}
repeat with eachLine in theLines
tell application "Reminders"
set mylist to list "Your List Name"
tell mylist
make new reminder at end with properties {name:eachLine, due date:date "7/10/2014 3:00 PM"}