This file contains hidden or 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 STRIPE_SECRET = 'STRIPE_SECRET'; | |
// const keyPublishable = 'pk_test_19ahJzPH2xE2Dd9zhqv6R6fR'; | |
const STRIPE_SECRET = 'sk_test_ZqMsK6wX4raLqGcICamzZiP9'; | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const path = require('path'); | |
const stripe = require('stripe')(STRIPE_SECRET); |
This file contains hidden or 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
exports.handler = function(context, event, callback) { | |
var SquareConnect = require('square-connect'); | |
var Twilio = require('twilio'); | |
var accessToken = context.accessToken; | |
var locationId = context.locationId; | |
var messageBody = event.message; | |
var number = event.number; | |
This file contains hidden or 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 SquareConnect = require('square-connect'); | |
const crypto = require('crypto'); | |
const querystring = require('querystring'); | |
module.exports.checkout = (event, context, callback) => { | |
(SquareConnect.ApiClient.instance).authentications["oauth2"].accessToken = process.env.ACCESS_TOKEN; | |
const formData = querystring.parse(event.body); | |
const locationId = process.env.LOCATION_ID; | |
const checkoutRequest = { | |
idempotency_key: crypto.randomBytes(48).toString('base64'), |
This file contains hidden or 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
/** | |
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from | |
* a base64 string. | |
* Updated to use Promise (bluebird) | |
* Web: https://mayneweb.com | |
* | |
* @param {string} base64 Data | |
* @return {string} Image url | |
*/ | |
const imageUpload = async (base64) => { |
This file contains hidden or 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
http://jsfiddle.net/a9ude9p0/6/ | |
#html | |
<div> | |
<svg class="svg icon icon_type_turbo-rocket turbo-promo__logo" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path class="svg__path" d="M5.3 8c.423-.54.937-1.11 1.523-1.7 2.295-2.31 4.84-2.446 5.082-2.202.242.245.09 2.77-2.205 5.08-.59.594-1.16 1.112-1.7 1.536v1.62c0 .666.015.688-.406 1-.225.166-1.194.96-2.234 1.597-.255.158-.466.028-.304-.2.44-.62.756-1.173.95-1.66.178-.446.177-.842-.003-1.19-.663.212-1.218.15-1.626-.248-.41-.4-.472-.96-.253-1.633-.348-.183-.746-.185-1.195-.006-.488.194-1.04.51-1.66.95-.23.16-.358-.05-.202-.305C1.704 9.6 2.5 8.63 2.666 8.404 2.978 7.985 3 8 3.666 8H5.3zm-2.05 3.605c.14.14-1.72.956-1.72 2.867 1.91 0 2.726-1.86 2.866-1.72.14.14-.31 1.22-1.074 1.984C2.558 15.5 1.53 16 0 16c0-1.528.5-2.557 1.265-3.32.764-.766 1.845-1.214 1.984-1.075zM.7 8c-.004.322-.404.348-.4 0 .048-4.418 2.992-8 7.696-8s8 3.3 8 8-3.582 7.668-8 7.698c-.15 0-.217-.098-.217-.197-.002-.1.065-.2.216-.2 3.698.008 6.802-3.3 6.802-7.3s-2.802 |
This file contains hidden or 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 async = require('async'); | |
var AWS = require('aws-sdk'); | |
var gm = require('gm').subClass({imageMagick: true}); | |
var util = require('util'); | |
var MAX_WIDTH = 100; | |
var MAX_HEIGTH = 100; | |
var s3 = new AWS.S3(); |
This file contains hidden or 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
'use strict'; | |
const aws = require('aws-sdk'); | |
exports.s3PutBase64 = (image, folder, imageName) => { | |
return new Promise(function(resolve, reject) { | |
const buf = new Buffer(image.replace(/^data:image\/\w+;base64,/, ""), 'base64'); | |
const s3 = new aws.S3(); | |
aws.config = { |
This file contains hidden or 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 express = require('express') | |
var bodyParser = require('body-parser') | |
var path = require('path') | |
// payments | |
var keyPublishable = 'PUT YOUR TEST PUBLISHABLE KEY HERE (THIS STARTS WITH pk_)' | |
var keySecret = 'PUT YOUR TEST SECRET KEY HERE (THIS STARTS WITH sk_)' | |
var stripe = require('stripe')(keySecret) | |
// server |
This file contains hidden or 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 AWS = require('aws-sdk'); | |
AWS.config.loadFromPath('./config.json'); | |
const s3 = new AWS.S3(); | |
const uuidV4 = require('uuid'); | |
const request = require('request'); | |
const s3Bucket = new AWS.S3( { params: { Bucket: 'samus-original-bucket' } } ) | |
request.get({ | |
method: 'GET', | |
url: 'http://lorempixel.com/400/200/', |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id="app"> | |
<router-view class="view"></router-view> |
NewerOlder