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
// listen for all clicks on anything. You could change document to a selector like #content to make it more efficient. | |
$(document).on('click', function( e ) { | |
// if this is a link, and the href does not contain our domain, it's an external link. Track it. | |
if( e.target.href && e.target.href.indexOf( window.location.hostname ) < 0 ) { | |
ga('send', 'event', { | |
eventCategory: 'Outbound Link', | |
eventAction: 'click', | |
eventLabel: e.target.href, // the outbound link url will appear as the event label in GA. Find under Behavior -> Events -> Event Label | |
transport: 'beacon' // not supported in some versions of IE | |
}); |
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: AppPresser In App Purchases for Paid Memberships Pro | |
Plugin URI: https://apppresser.com | |
Description: This plugin listens for in app purchases or cancellations and adds/removes members from a membership level. | |
Version: 2.0.0 | |
Author: Scott Bolinger | |
Author URI: https://apppresser.com | |
License: GPLv2 | |
*/ |
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
// we have an array of objects, we want to remove one object using only the id property | |
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}]; | |
// get index of object with id of 37 | |
const removeIndex = apps.findIndex( item => item.id === 37 ); | |
// remove object | |
apps.splice( removeIndex, 1 ); | |
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
do { | |
// We only get 100 subscribers, if there's a nextToken, get the next 100 | |
if( $nextToken ) { | |
$result = $client->listEndpointsByPlatformApplication(array( | |
'PlatformApplicationArn' => $gcm_arn, | |
'NextToken' => $nextToken | |
)); | |
} else { | |
// Run this the first time, since there's no nextToken yet | |
$result = $client->listEndpointsByPlatformApplication(array( |
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 | |
function appp_redirect() { | |
global $wp; | |
$current_url = home_url( $wp->request ); | |
$string = apply_filters( 'ap3_bp_me_url', '/me/' ); | |
$me = stripos( $current_url, $string ); |
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 | |
// add this code to a custom plugin | |
add_filter( 'woocommerce_rest_prepare_product_object', 'wc_app_add_custom_data_to_product', 10, 3 ); | |
// filter the product response here | |
function wc_app_add_custom_data_to_product( $response, $post, $request ) { | |
// in this case we want to display the short description, so we copy it over to the description, which shows up in the app | |
$response->data['description'] = $response->data['short_description']; | |
return $response; |
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: In App Purchases for MemberPress | |
Plugin URI: https://apppresser.com | |
Description: This plugin listens for in app purchases or cancellations and adds/removes members from a membership level. | |
Version: 2.0.0 | |
Author: Scott Bolinger | |
Author URI: https://apppresser.com | |
License: GPLv2 | |
*/ |
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: AppPresser In App Purchases for Indeed Memberships | |
Plugin URI: https://apppresser.com | |
Description: This plugin listens for in app purchases or cancellations and adds/removes members from a membership level. | |
Version: 1.0.0 | |
Author: Scott Bolinger | |
Author URI: https://apppresser.com | |
License: GPLv2 | |
*/ |
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
// This is just for example purposes, copy/pasting this won't work out of context. It is from the Gatsby Publisher theme by Static Fuse. | |
import React from 'react' | |
import { Box } from '@chakra-ui/core' | |
import Layout from '../../components/Layout' | |
import PostEntry from '../../components/PostEntry' | |
import Pagination from '../../components/Pagination' | |
import HeaderArchive from '../../components/HeaderArchive' | |
import SEO from '../../components/SEO' | |
import { useQuery } from '@apollo/react-hooks' | |
import gql from 'graphql-tag' |
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
// to update a property in an object, for example a title | |
setMyState({ | |
...currentState, | |
title: newTitle, | |
}); | |
/* Explanation below... | |
// we have an object set as state |
NewerOlder