View ngrok-and-jetpack.md

How to develop with Jetpack locally with ngrok

To connect Jetpack in your local installation, you'll need a way for WP.com servers to reach your server. That can be done in a number of different ways:

  • You can open your router's ports and use your public IP
  • You can use some kind of Dynamic DNS provider.

But these options fall short of ngrok, which is a "localhost tunnel". It basically allows the Internet to hit a local port on your machine without worrying about ports or IPs.

As long as ngrok is running, Jetpack / WP.com will be able to communicate with your local site. This will allow remote modules like Site Search and Manage to work.

View amphtml-rest-response.php
<?php
add_filter( 'rest_prepare_post', 'amp_add_amphtml_link_to_rest_response', 10, 2 );
function amp_add_link_to_rest_response( $response, $post ) {
if ( ! post_supports_amp( $post ) ) {
return $response;
}
$response->add_link( 'amphtml', amp_get_permalink( $post->ID ) );
View msm-sitemap-fixer.php
<?php
class MSM_Sitemap_Fixers_Command extends WP_CLI_Command {
/**
* Regenerate sitemaps with broken dates
*
* @subcommand fix-msm-sitemap-dates
*/
function fix_msm_sitemap_dates( $args, $assoc_args ) {
$defaults = array();
View gist:788bb4654dabbadb030d
diff --git a/desktop/env.js b/desktop/env.js
index 68fac96..1dbc45a 100644
--- a/desktop/env.js
+++ b/desktop/env.js
@@ -86,7 +86,8 @@ debug( '========================================================================
global.desktop = {
config: config,
settings: Settings,
- editorContextMenu: EditorContextMenu,
- generalContextMenu: GeneralContextMenu
View emoji-one.php
<?php
/**
* Plugin Name: Emoji One
* Description: Use assets from Emoji One (emojione.com) when displaying emoji.
* Version: 0.1
*/
add_filter( 'emoji_url', '//cdn.jsdelivr.net/emojione/assets/png/' );
View usage.php
<?php
vip_register_async_script( 'twitter', 'https://platform.twitter.com/widgets.js' );
View wp-android-checkstyle.diff
diff --git a/tools/checkstyle.sh b/tools/checkstyle.sh
index 8f536e2..e206727 100755
--- a/tools/checkstyle.sh
+++ b/tools/checkstyle.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-if [ x"$1" == x ]; then
+if [ -z "$1" ]; then
checkstyle -c cq-configs/checkstyle/checkstyle.xml -r src/
View wp-error-merge.php
<?php
function wpcom_wp_error_merge() {
$wp_error_merged = new WP_Error();
$wp_errors = func_get_args();
foreach ( $wp_errors as $wp_error ) {
if ( ! is_wp_error( $wp_error ) )
continue;
foreach ( $wp_error as $key => $errors ) {
View data-attributes.php
<?php
add_action( 'after_setup_theme', 'x_kses_allow_data_attributes_on_links' );
function x_kses_allow_data_attributes_on_links() {
global $allowedposttags;
$tags = array( 'a' );
$new_attributes = array(
'data-foo' => array(),
'data-bar' => array(),
View x_maybe_load_ad_busters.php
<?php
add_action( 'init', 'x_maybe_load_ad_busters' );
function x_maybe_load_ad_busters() {
$ad_busters = array(
'/adcentric/ifr_b.html',
'/atlas/atlas_rm.htm',
'/doubleclick/DARTIframe.html',
'/eyereturn/eyereturn.html',