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
| ... | |
| http { | |
| ... | |
| log_format mine '$uri - $blogid : $http_host'; | |
| ... | |
| } |
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
| var i, key, pairs, | |
| obj = {'4': 'alpha', '2': 'beta', '5': 'gamma', '1': 'delta', '3': 'epsilon'}; | |
| for (key in obj) { | |
| console.log(key + ': ' + obj[key]); | |
| } | |
| pairs = _.pairs(obj); | |
| obj = _.sortBy(pairs, function (item) { return item[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
| <?php | |
| /* | |
| Plugin Name: WordPress serves JSON | |
| Description: Serve your content as JSON or JSONP in a simple manner (based on an example by Jon Cave - http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/). | |
| Plugin URI: https://gist.github.com/lloc/8933914 | |
| Author: realloc | |
| Author URI: http://lloc.de/ | |
| */ | |
| namespace LLOC\realloc; |
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
| jQuery(document).ready(function($) { | |
| $('#message-box').html( | |
| objectL10n.str_hello_world | |
| ); | |
| }); |
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 my_enqueue_scripts() { | |
| wp_enqueue_style( 'my-style', get_stylesheet_uri() ); | |
| wp_enqueue_script( | |
| 'my-script', | |
| get_template_directory_uri() . '/js/script.js', | |
| array( 'jquery' ), | |
| false, | |
| 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
| # Install PHP_CodeSniffer | |
| sudo apt-get install php-codesniffer | |
| # Install the WordPress Coding Standards | |
| sudo git clone git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git \ | |
| $(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress | |
| # Now your can check your files like this | |
| phpcs --standard=WordPress your-file.php |
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 | |
| namespace WPSE\realloc; | |
| function my_site_menu( $field ) { | |
| $field['choices'] = array(); | |
| $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); | |
| if ( is_array( $menus ) ) { | |
| foreach( $menus as $menu ) { | |
| $field['choices'][$menu->name] = $menu->name; |
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 | |
| """ | |
| The config.ini contains something like: | |
| [Proxy] | |
| proxy = http://YOURPROXY/proxy.pac | |
| user = YOURUSER | |
| pass = YOURPASS | |
| local = proxy.pac |
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 | |
| namespace WPSE\realloc; | |
| if ( is_admin() ) { | |
| function remove_quick_edit( $actions, $post ) { | |
| if( ! current_user_can( 'manage_options' ) ) | |
| unset( $actions['inline hide-if-no-js'] ); | |
| return $actions; | |
| } |
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 | |
| define( 'PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); | |
| function my_plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) { | |
| if ( PLUGIN_BASENAME == $plugin_file ) | |
| $actions[] = '<a href="#">Test: plugin_action_links</a>'; | |
| return $actions; | |
| } | |
| add_filter( 'plugin_action_links', 'my_plugin_action_links', 10, 4 ); |