Skip to content

Instantly share code, notes, and snippets.

View reggie3's full-sized avatar

Reginald Johnson reggie3

View GitHub Profile
@reggie3
reggie3 / BraintreeLambda.js
Last active November 2, 2021 11:20
Braintree Node Server Lambda
/***********************************************************************************
AWS Lambda boilerplate for API functions
This boilerplate is designed to be used with AWS API gateway and to return information
to a client
***********************************************************************************/
const util = require("util");
// - provide access to aws-sdk
//const AWS = require('aws-sdk');
@reggie3
reggie3 / gist:1effd88e76b855d6bb7435320bfa893f
Created September 20, 2017 01:51
Webpack config for Braintree JS Project
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
module.exports = {
entry: './web/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js',
},
@reggie3
reggie3 / index.js
Last active September 25, 2017 19:52
Braintree Payment Javascript Version index.js
import RNMessageChannel from "./react-native-webview-messaging";
const dropin = require("braintree-web-drop-in");
const submitButton = document.querySelector("#submit-button");
let clientToken = "";
const goBackButton = document.querySelector("#go-back-button");
const noticeBox = document.querySelector("#notice-box");
const loader = document.querySelector("#loader");
// receive the tokenReceived event
@reggie3
reggie3 / react-webpack.js
Created October 1, 2017 23:47
Webpack to Convert JSX
const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./web/braintreeReact.js",
output: {
path: path.join(__dirname, "dist"),
filename: "[name].bundle.js"
},
@reggie3
reggie3 / braintreeReact.js
Last active October 7, 2017 11:27
react file for use in braintree webview
// download and use react an react-dom from local directory
// to avoid conflicts with Expo version of react
import React from "./react.min";
import ReactDOM from "./react-dom.min";
import renderIf from "render-if";
import dropin from "braintree-web-drop-in";
import glamorous from "glamorous";
import RNMessageChannel from "react-native-webview-messaging";
const util = require("util");
<SoundRecorder
style={{ flex: 1 }}
onComplete={this.soundRecorderComplete.bind(this)}
maxDurationMillis={150000}
completeButtonText={'Finished'}
/>
soundRecorderComplete = (soundFileInfo) => {
soundFileInfo =
typeof soundFileInfo === 'object'
? JSON.stringify(soundFileInfo, undefined, 2)
: soundFileInfo;
this.setState({
viewToShow: 'home',
soundFileInfo
});
@reggie3
reggie3 / gist:281764f555bb65138e096f636bacba0a
Last active June 6, 2018 00:28
Problem With Animation
import React, { Component } from 'react';
import {
View,
StyleSheet,
Modal,
Keyboard,
KeyboardAvoidingView,
Animated,
TouchableWithoutFeedback,
Easing
@reggie3
reggie3 / handle.js
Last active June 22, 2018 17:43
webview parent component handle message gist
handleMessage = (event) => {
let msgData;
try {
msgData = JSON.parse(event.nativeEvent.data);
if (
msgData.hasOwnProperty('prefix') &&
msgData.prefix === MESSAGE_PREFIX
) {
console.log(`WebViewLeaflet: received message: `, msgData.payload);
@reggie3
reggie3 / sendMessage.js
Last active June 22, 2018 18:04
Webview sendMessage function
<Map
style={{
width: '100%',
backgroundColor: 'lightblue'
}}
...
// handling a react-leaflet map click event
onClick={(event) => {
this.onMapEvent('onMapClicked', {
coords: [event.latlng.lat, event.latlng.lng]