Skip to content

Instantly share code, notes, and snippets.

View reggie3's full-sized avatar

Reginald Johnson reggie3

View GitHub Profile
<SoundRecorder
style={{ flex: 1 }}
onComplete={this.soundRecorderComplete.bind(this)}
maxDurationMillis={150000}
completeButtonText={'Finished'}
/>
@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");
@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 / 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 / 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 / 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');
render() {
return (
<Expo.MapView.Marker
key={this.props.key}
coordinate={{
latitude: this.props.location.loc[0],
longitude: this.props.location.loc[1],
}}>
<FontAwesome
componentDidMount = () => {
let animation = this.requestAnimationFrame(this.animationLooper.bind(this));
}
animationLooper = () => {
let now = Date.now();
let deltaTime = now - this.state.then;
// user distance = time * rate to determine the amount the marker should grow or shrink
let growth = deltaTime / 1000 * this.state.markerGrowthSpeed;
componentWillReceiveProps(nextProps) {
if (nextProps.location.distanceAverage < 10) {
this.setState({ loopSpeed: 10 });
}
else if (nextProps.location.distanceAverage < 100) {
this.setState({ loopSpeed: 100 });
}
else if (nextProps.location.distanceAverage < 1000) {
this.setState({ loopSpeed: 500 });
}
const monster1 = require('../assets/sprites/monster/monster_walk01.png')
const monster2 = require('../assets/sprites/monster/monster_walk02.png')
const monster3 = require('../assets/sprites/monster/monster_walk03.png')
class LocationMarker extends Component {
constructor(props) {
super(props);
this.state = {
imageCounter: 0,