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/bash | |
set_disk_speedbump () { | |
local sd_disk_path=${1} | |
local sd_disk_id=${2} | |
if (( $sd_disk_id < 2 )); then | |
read -p "Are you sure ${sd_disk_path}${sd_disk_id} is the SD Card? (y/n) " disk_verify | |
if [[ "${disk_verify}" == 'y' ]]; then |
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
const userFields = [ | |
{ key: "name", value: "tyler" }, | |
{ key: "location", value: "boston" }, | |
{ key: "phone", value: "555-555-5555" }, | |
{ key: "email", value: "tyler@test.com" }, | |
{ key: "color", value: "red" }, | |
{ key: "sport", value: "golf" } | |
]; | |
const primaryFields = [ |
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
function current_product($product_type){ | |
global $post; | |
$price_meta = get_post_meta($post->ID, 'peruse-article-price'); | |
$price = isset($price_meta[0]) ? $price_meta[0] : '.25'; | |
return [ | |
'id' => $post->ID, |
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
function get_peruse_token(){ | |
return peruse_user_token(); | |
} | |
wp_enqueue_script( 'peruse-local', get_template_directory_uri() . '/js/peruse.js', array('jquery')); | |
wp_localize_script('peruse-local', 'peruse', | |
array( | |
'token' => get_peruse_token(), | |
'url' => 'app.goperuse.com/', | |
'user' => peruse_current_user(), |
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
function peruse_pay_btn($postId, $default) { | |
$price_meta = get_post_meta($postId, 'peruse-article-price', true); | |
$price = $price_meta ? $price_meta : $default; | |
$output = '<div class="peruse_pay_container">'; | |
$output .= '<button id="peruse_pay_submit">Continue for $' . $price . '</button>'; | |
$output .= '<div id="peruse_confirm_product"></div>'; | |
$output .= '</div>'; |
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
function standard_integration( $content ) { | |
if ( is_single() && 'post' == get_post_type() ) { | |
global $post; | |
if(!peruse_post_auth($post->ID, 'Article', null)){ | |
$content_noAuth = has_excerpt($post->ID) ? get_the_excerpt($post->ID) : ''; | |
$content_noAuth .= peruse_pay_btn($post->ID, '.25'); |
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
function get($route) { | |
if(isset($_SESSION['peruse_access_token'])){ | |
$request = $provider->getAuthenticatedRequest( | |
'GET', | |
'https://app.goperuse.com/api/graph/v1/' . $route, | |
$_SESSION['peruse_access_token'] | |
); | |
$response = $provider->getHttpClient()->send($request); |
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
var product = { | |
title: 'Post Title', | |
type: 'Article', | |
id: '100', | |
product_url: 'http://www.example.com/post-slug', | |
description: '', | |
regular_price: .15 | |
} | |
var msg_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 | |
session_start(); | |
define('CLIENT_ID', XXXXXXX); | |
define('CLIENT_SECRET', XXXXXXXXXXXXXXXXXXXXXXX); | |
define('REDIRECT_URI', rtrim(site_url(), '/') . '/'); | |
if (CLIENT_ID && CLIENT_SECRET){ | |
$this->provider = new \League\OAuth2\Client\Provider\GenericProvider([ |