Skip to content

Instantly share code, notes, and snippets.

View ChrisFlannagan's full-sized avatar

Chris Flannagan ChrisFlannagan

View GitHub Profile
@ChrisFlannagan
ChrisFlannagan / RetrieveFeedTask.java
Last active September 11, 2015 18:18
Chris Flannagan - Code Samples
package com.tapmap.app.tapmapapp;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.content.res.Resources;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
SELECT ID, sm_email, sm_outfit, COUNT( * )
FROM orders
GROUP BY sm_email, sm_outfit
HAVING COUNT( * ) >1
LIMIT 0 , 400
@ChrisFlannagan
ChrisFlannagan / demo.js
Last active April 20, 2016 18:59
WordPress Embeds
$("#submit-button").click(function() {
$(this).attr("disable", true);
});
$pay = 'Full Payment';
$result = $con->query( $sql );
while ( $row = $result->fetch_assoc() ) {
if( $row['sm_pay'] == 'Split Payment' ) {
$pay = 'Split Payment';
}
}
$result = $con->query( $sql );
while ( $row = $result->fetch_assoc() ) {
<?php
$invoice = new Invoice();
// ### Invoice Info
$invoice
->setMerchantInfo( new MerchantInfo() )
->setBillingInfo( array( new BillingInfo() ) )
->setNote( "Thank you, customer!" )
->setPaymentTerm( new PaymentTerm() )
->setShippingInfo( new ShippingInfo() )
<?php
require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
require __DIR__ . '/PayPal-PHP-SDK/paypal/rest-api-sdk-php/sample/bootstrap.php';
use \PayPal\Api\Address;
use PayPal\Api\BillingInfo;
use PayPal\Api\Cost;
use PayPal\Api\Currency;
use PayPal\Api\Invoice;
use PayPal\Api\InvoiceAddress;
$("form").submit(function() {
$(this).find("button[type='submit']").prop('disabled',true);
});
<?php
//PayPal wants an array of InvoiceItem() objects
$items = array()
$cnt = 0;
foreach( $order['items'] as $item ) {
$items[ $cnt ] = new InvoiceItem();
$items[ $cnt ]
->setName( $item['outfit'] . '-' . $item['size'] )
->setQuantity( 1 )
->setUnitPrice( new Currency() );
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
require __DIR__ . '/api/paypal/PayPal-PHP-SDK/autoload.php';
require __DIR__ . '/api/paypal/PayPal-PHP-SDK/paypal/rest-api-sdk-php/sample/bootstrap.php';
use \PayPal\Api\Address;
use PayPal\Api\BillingInfo;
use PayPal\Api\Cost;
use PayPal\Api\Currency;
use PayPal\Api\Invoice;
use PayPal\Api\InvoiceAddress;
<?php
//Fields used to set our API keys for different gateways
public $stripe_field_options = array(
'stripe-label' => array( 'label' => 'Stripe Shortcode', 'type' => 'admin', 'size' => '', 'admin' => 'row', 'extra' => '[name-your-donation gateway="stripe"]' ),
'stripe-mode' => array( 'label' => 'Stripe Test Mode', 'type' => 'checkbox', 'size' => '', 'admin' => 'checkbox', 'extra' => '' ),
'stripe-tsk' => array( 'label' => 'Stripe Test Secret Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ),
'stripe-tpk' => array( 'label' => 'Stripe Test Public Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ),
'stripe-lsk' => array( 'label' => 'Stripe Live Secret Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ),
'stripe-lpk' => array( 'label' => 'Stripe Live Public Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ),
);