This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew update | |
brew versions FORMULA | |
cd `brew --prefix` | |
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions" | |
brew install FORMULA | |
brew switch FORMULA VERSION | |
git checkout -- Library/Formula/FORMULA.rb # reset formula | |
## Example: Using Subversion 1.6.17 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo Install all AppStore Apps at first! | |
# no solution to automate AppStore installs | |
read -p "Press any key to continue... " -n1 -s | |
echo '\n' | |
echo Install and Set San Francisco as System Font | |
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)" | |
echo Install Homebrew, Postgres, wget and cask | |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Lock your self out | |
* Plugin URI: https://ngo-portal.org | |
* Description: Show how you get locked out when using current_user_can in a plugin that get's network activated. | |
* Just put this file in your plugins folder and go to plugins, network activate it, and you will get locked out. | |
* To get back in use ftp and rename this file (I use to add _ after filename like so lock-your-self-out.php_ | |
* Reload your browser. Now your back in. | |
* Version: 0.0.1 | |
* Author: George Bredberg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_footer', function() // works best, but does not show up if the footer is removed.. | |
// add_action( 'admin_menu', function() // Hides a bit, but copy and past to textfile to read | |
{ | |
if ( empty ( $GLOBALS['wp_widget_factory'] ) ) | |
return; | |
$widgets = array_keys( $GLOBALS['wp_widget_factory']->widgets ); | |
print '<pre>$widgets = ' . esc_html( var_export( $widgets, TRUE ) ) . '</pre>'; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Wally-theme is dependant on wally-plugin, but we don't want site-admins to touch plugins, so we do this programatically. | |
// Enable Wally plugin when theme is activated | |
function ngo_activate_wally_plugin() { | |
//Get wally-plugin pathinfo | |
$wally_plugin = WP_PLUGIN_DIR . '/wally-plugin/index.php'; | |
activate_plugins ( $wally_plugin, $redirect = '', false, true ); | |
} | |
add_action( "after_switch_theme", "ngo_activate_wally_plugin" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if mother-plugins are installed and activated | |
// If not, deactivate this plugin and print an error message. | |
add_action( 'admin_init', 'child_plugin_has_parent_plugin' ); | |
function child_plugin_has_parent_plugin() { | |
$req_plugins = array( 'multi-site-site-list-shortcode/multi-site-site-list-shortcode.php', 'link-manager/link-manager.php' ); | |
foreach ($req_plugins as $req_plugin) { | |
if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( $req_plugin ) ) { | |
add_action( 'admin_notices', 'child_plugin_notice' ); | |
deactivate_plugins( plugin_basename( __FILE__ ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Check if mother-plugin is installed and activated | |
// If not, deactivate this plugin and print an error message. | |
add_action( 'admin_init', 'eongo_plugin_has_parent_plugin' ); | |
function eongo_plugin_has_parent_plugin() { | |
$req_plugin = 'event-organiser/event-organiser.php'; | |
if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( $req_plugin ) ) { | |
add_action( 'admin_notices', 'eongo_plugin_notice' ); | |
deactivate_plugins( plugin_basename( __FILE__ ) ); | |
if ( isset( $_GET['activate'] ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* == About this Gist == | |
* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
* // This is a gist, copied here for convenience, but please see source down for the maintainer and give the credit to them. // | |
* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
* | |
* Code to add to wp-config.php to enhance information available for debugging. | |
* | |
* You would typically add this code below the database, language and salt settings |