This file contains hidden or 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 | |
| function tott_enable_menu_export() { | |
| global $wp_post_types; | |
| $wp_post_types['nav_menu_item']->_builtin = false; | |
| } | |
| add_action( 'load-export.php', 'tott_enable_menu_export' ); |
This file contains hidden or 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
| // redirect all gravity forms to ssl | |
| add_action( 'template_redirect', 'sav_force_ssl_for_contact_forms', 1 ); | |
| function sav_force_ssl_for_contact_forms() { | |
| if ( is_page() && ! is_ssl() ) { | |
| global $post; | |
| if ( ! preg_match( '#\[gravityform#msiU', $post->post_content ) ) | |
| return; |
This file contains hidden or 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_filter( 'upload_dir', '_enforce_https_uploads' ); | |
| function _enforce_https_uploads( $upload_dir ) { | |
| $upload_dir['url'] = preg_replace( '#^https?://#', '//', $upload_dir['url'] ); | |
| $upload_dir['baseurl'] = preg_replace( '#^https?://#', '//', $upload_dir['baseurl'] ); | |
| return $upload_dir; | |
| } |
This file contains hidden or 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
| #!/usr/bin/env python | |
| """ | |
| Produces load on all available CPU cores | |
| """ | |
| from multiprocessing import Pool | |
| from multiprocessing import cpu_count | |
| def f(x): | |
| while True: |
This file contains hidden or 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/bash | |
| # This is a simple script to gather some basic information about the system | |
| # usage: | |
| # git clone git://gist.github.com/3979756.git get-system-info | |
| # cd get-system-info ; sh ./get-system-info.sh > system-info.log | |
| header(){ | |
| echo '-------------------------------------------------------------------' | |
| echo $1 |
This file contains hidden or 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
| #!/usr/bin/env python | |
| """ | |
| Produces load on all available CPU cores | |
| """ | |
| from multiprocessing import Pool | |
| from multiprocessing import cpu_count | |
| def f(x): | |
| while True: |
This file contains hidden or 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
| function mini_backtrace( $log = true ) { | |
| $trax = array(); | |
| $trace = debug_backtrace(); | |
| foreach ( $trace as $key => $trc ) { | |
| $trax[$key] = '[' . $key . '] : ' . $trc['file'] . '::' . $trc['line'] . ' - ' . $trc['function']; | |
| } | |
| if ( true === $log ) | |
| error_log( var_export( $trax, true ) ); | |
| return $trax; | |
| } |
This file contains hidden or 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 | |
| add_action( 'plugins_loaded', 'bypass_wp_login_for_pw_protected_posts' ); | |
| function bypass_wp_login_for_pw_protected_posts() { | |
| // this functionality is a fork of http://core.trac.wordpress.org/browser/trunk/wp-login.php#L385 | |
| // keep this in sync with Core | |
| $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login'; | |
| if ( 'postpass' <> $action ) | |
| return; |
This file contains hidden or 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
| if( !class_exists( 'Easy_CF_Field_RichText' )) { | |
| class Easy_CF_Field_RichText extends Easy_CF_Field { | |
| public function print_form() { | |
| $class = ( empty( $this->_field_data['class'] ) ) ? $this->_field_data['id'] . '_class' : $this->_field_data['class']; | |
| $input_class = ( empty( $this->_field_data['input_class'] ) ) ? $this->_field_data['id'] . '_input_class' : $this->_field_data['input_class']; | |
| $id = ( empty( $this->_field_data['id'] ) ) ? $this->_field_data['id'] : $this->_field_data['id']; | |
| $label = ( empty( $this->_field_data['label'] ) ) ? $this->_field_data['id'] : $this->_field_data['label']; | |
| $value = $this->get(); | |
| $hint = ( empty( $this->_field_data['hint'] ) ) ? '' : '<p><em>' . $this->_field_data['hint'] . '</em></p>'; |
This file contains hidden or 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
| if ( !class_exists( "Easy_CF_Field_Image" ) ) { | |
| class Easy_CF_Field_Image extends Easy_CF_Field { | |
| public function print_form() { | |
| $class = ( empty( $this->_field_data['class'] ) ) ? $this->_field_data['id'] . '_class' : $this->_field_data['class']; | |
| $input_class = ( empty( $this->_field_data['input_class'] ) ) ? $this->_field_data['id'] . '_input_class' : $this->_field_data['input_class']; | |
| $name = ( empty( $this->_field_data['name'] ) ) ? $this->_field_data['id'] : $this->_field_data['name']; | |
| $id = ( empty( $this->_field_data['id'] ) ) ? $this->_field_data['id'] : $this->_field_data['id']; | |
| $label = ( empty( $this->_field_data['label'] ) ) ? $this->_field_data['id'] : $this->_field_data['label']; | |
| $value = $this->get(); | |
| $hint = ( empty( $this->_field_data['hint'] ) ) ? '' : '<p><em>' . $this->_field_data['hint'] . '</em></p>'; |