Skip to content

Instantly share code, notes, and snippets.

@mcascardi
mcascardi / ajax.php
Created October 31, 2018 17:33
Fast AJAX handler for wp
<?php
/**
* Hello, this is a minimal ajax handler for WP.
* Based off of: https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress which didn't work for me out of the box.
* Note: replace tld with your own prefix.
* Handles get and post type requests.
* Assumes you put this file in the root directory of your theme folder.
*/
$_tld_ajax = [];
@nrollr
nrollr / Commands.sh
Last active August 20, 2024 20:36
Install PHP and NGINX on Amazon Linux AMI
## Install NGINX
## when installing on Amazon Linux AMI, use:
$ sudo yum install nginx -y
## when installing on Amazon Linux 2 AMI, use
$ sudo amazon-linux-extras install nginx1.12 -y
## Install PHP and PHP-FPM
# for PHP version 7.1 use php71 and php71-fpm instead
$ sudo yum install php -y
$ sudo yum install php-fpm -y
@danielpataki
danielpataki / basic-deactivation.php
Last active July 4, 2021 17:30
Installation And Uninstallation Hooks
register_deactivation_hook( __FILE__, 'my_plugin_deactivation' );
function my_plugin_deactivation() {
// Deactivation rules here
}
anonymous
anonymous / config.json
Created September 4, 2014 18:01
Bootstrap Customizer Config
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 46.7%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
@iandunn
iandunn / programmatic_login.php
Last active March 7, 2023 18:18
Programmatically log in a WordPress user
/**
* Programmatically logs a user in
*
* @param string $username
* @return bool True if the login was successful; false if it wasn't
*/
function programmatic_login( $username ) {
if ( is_user_logged_in() ) {
wp_logout();
@jankkhvej
jankkhvej / shellcommand.sh
Created August 1, 2011 06:52 — forked from anonymous/shellcommand.sh
script to parse PHP short open tags and convert ones to normal
find project/dir/ -type f -iname "*.php" -exec php -d short_open_tag=On the_script.php {} \;