Skip to content

Instantly share code, notes, and snippets.

View simonho288's full-sized avatar
🏠
Working from home

Simon Ho simonho288

🏠
Working from home
View GitHub Profile
#include <eosiolib/eosio.hpp>
using namespace eosio;
class election : public contract
{
private:
// create the multi index tables to store the data
/// @abi table
def doViewProductDetail(self, product_id, client_rec, m_nls, user_id):
logger.debug(str(currentframe().f_lineno) + ":" + inspect.stack()[0][3] + "()")
assert isinstance(product_id, str)
if self.m_woocom is None:
rec_wc = client_rec["woocommerce"]
self.m_woocom = mod_woocommerce.Wc(rec_wc["url"], rec_wc["consumer_key"],rec_wc["consumer_secret"])
if self.raw_gensts is None: # needs for formatting currency
self.raw_gensts = self.m_woocom.getGeneralSetting()
self.parseGeneralSetting(self.raw_gensts)
product = self.m_woocom.getProductDetail(product_id)
function onPayloadViewProduct(client, rs, userId, recipientId, productId) {
console.log('%s:%d onPayloadViewProduct()', path.basename(__filename), __line)
console.assert(client, util.format('%s-%d', path.basename(__filename), __line))
console.assert(rs, util.format('%s-%d', path.basename(__filename), __line))
console.assert(userId, util.format('%s-%d', path.basename(__filename), __line))
console.assert(recipientId, util.format('%s-%d', path.basename(__filename), __line))
console.assert(productId, util.format('%s-%d', path.basename(__filename), __line))
return new Promise((resolve, reject) => {
let fbAccessToken = client.getFacebookAccessToken()
body {
padding: 1em;
}
.spaced > .button {
margin-bottom: 1em;
}
.color.grid {
margin: -1.5em;
width: 400px;
}
$(document).ready(function() {
$('.ui.menu .ui.dropdown').dropdown({
on: 'hover'
})
$('.ui.menu a.item').on('click', function() {
$(this).addClass('active').siblings().removeClass('active')
})
$('.ui.dropdown').dropdown();
$('.ui.buttons .dropdown.button').dropdown({
const gulp = require('gulp')
const pug = require('gulp-pug')
const less = require('gulp-less')
const minifyCSS = require('gulp-csso')
const runSequence = require('run-sequence')
const chug = require('gulp-chug')
const OUTPUT_DIR = 'public'
gulp.task('html', () => {
.ui.container
h1 Theming Examples
h2.ui.dividing.header Site
.ui.three.column.stackable.grid
.column
h1 Heading 1
h2 Heading 2
// ...
.ui.three.column.stackable.padded.middle.aligned.centered.color.grid
a#pay(class="btn btn-warning" href="") Pay with Card now
...
var checkout = StripeCheckout.configure({
key: '#{accessKey}',
token: function(token) {
window.location.replace('/stripe/charge/' + token.id)
},
image: 'https://www.simonho.net/MyImg150x150.jpg',
locale: 'en-US'
});
router.get('/charge/:token', (req, res) => {
let token = req.params.token
console.assert(token)
const amount = CHARGE_AMOUNT * 100
stripe.charges.create({
amount: amount,
currency: 'usd',
source: token,
description: 'Stripe experiment testing charge'
}, (err, charge) => {
#card-element
//- a Stripe Element will be inserted here.
div(id="card-errors" role="alert")
div(id="my-card-error-alert" class="alert alert-danger" role="alert" style="display:none")
h4.alert-heading Payment Failure
p#error-message
hr
p.mb-0 Please use another card and retry payment
...
script(src="https://js.stripe.com/v3/")