Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Shan shanwixcode

🏠
Working from home
View GitHub Profile
@shanwixcode
shanwixcode / gcpCalendarPage.js
Last active Jun 28, 2020
Wix Code - Web App For Google Calendar API
View gcpCalendarPage.js
import {client, getAuthUrl, generateTokens} from 'backend/config.jsw';
export function clientConfig_keyPress(event) {
if (event.key === "Enter") {
let str = $w('#clientConfig').value;
if (str.length === 0)
return;
client(str).then(item => {
$w('#configUploaded').show();
@shanwixcode
shanwixcode / gcpBackend.js
Last active Jun 28, 2020
Wix Code - Google Calendar API Backend File config
View gcpBackend.js
import wixData from 'wix-data';
const {google} = require("googleapis");
const SCOPES = ['https://www.googleapis.com/auth/calendar']; //the url of the api
let options = {
"suppressAuth": true //suppress db auth to allow secure db permissions
};
//-----------------------------Insert Client Config File Into Database----------------------------//
@shanwixcode
shanwixcode / gcp.js
Last active Jun 28, 2020
Wix Code - Google Calendar API Backend File 2
View gcp.js
import wixData from 'wix-data';
const {google} = require("googleapis");
let options = {
"suppressAuth": true //suppress db auth to allow secure db permissions
};
export async function insertNewEvent(summary, location, description, start, end, attendees) {
const authorizedAuthClient = await createAuthorizedClient();
return insertRow(authorizedAuthClient, summary, location, description, start, end, attendees);
@shanwixcode
shanwixcode / insert.js
Last active Jun 28, 2020
Wix Code - Google Calendar API Page Code
View insert.js
import {insertNewEvent} from 'backend/createEvent.jsw';
$w.onReady(function () {
});
var startdateNumber;
var startmonth;
var startyear;
var starttime;
@shanwixcode
shanwixcode / Corvid & Wix Gallery
Last active Aug 22, 2019
Code to load data into Wix Gallery using a Dataset
View Corvid & Wix Gallery
@shanwixcode
shanwixcode / Google & Outlook Calendar Event
Created Aug 31, 2019
Save The Date For Google & Outlook Calendar
View Google & Outlook Calendar Event
//Google Calendar Event
https://calendar.google.com/calendar/r/eventedit?text=The+Event+Name&dates=20191005T100000/20191005T220000&details=The+event's+day+session+is+from+10+AM+to+3+PM.+The+event's+evening+session+is+from+5+PM+to+10+PM.&location=The+Rooftop+at+Pier+17+89+South+Street+NY,+NY+10038+USA&ctz=America/New_York
//Outlook Calendar Event
https://outlook.live.com/owa/?path=/calendar/action/compose&rru=addevent&startdt=20191005T043000&enddt=20191005T163000&subject=The+Event+Name&body=The+event's+day+session+is+from+10+AM+to+3+PM.+The+event's+evening+session+is+from+5+PM+to+10+PM.&location=The+Rooftop+at+Pier+17+89+South+Street+NY,+NY+10038+USA
@shanwixcode
shanwixcode / subLb.rb
Last active Jun 28, 2020
Stripe Tutorial - Dude Lemon
View subLb.rb
export function selectPlan_click(event) {
let $item = $w.at(event.context);
$w('#selectPlan').hide(); //hide button
$item("#openingLb").show(); //show a loader animation on this item
let planData = $item("#plans").getCurrentItem(); //get the click item's data from its dataset
let deployData = {
name: planData.displayName,
price: planData.displayPrice,
planId: planData.planId,
currency: planData.currency
@shanwixcode
shanwixcode / stripeProcessor.js
Last active Jun 28, 2020
Stripe Tutorial - Dude Lemon
View stripeProcessor.js
//stripeProcessor.jsw
import stripe from 'stripe';
const key = require("stripe")("sk_test_xxxxxx"); //Stripe SECRET API Key
//---------------------------------------------Create Customer---------------------------------------------//
export function createCustomer(token, emailId) {
return key.customers.create({
@shanwixcode
shanwixcode / stripe.js
Created Jan 20, 2020
Stripe Tutorial - Dude Lemon
View stripe.js
//stripe.js
import {fetch} from 'wix-fetch';
const apiKey = "pk_test_xxxxxx"; //Stripe Public API Key
export async function stripeToken(cardObject) {
let values = encodeCard(cardObject);
@shanwixcode
shanwixcode / lightbox.js
Last active Jun 28, 2020
Stripe Tutorial - Dude Lemon
View lightbox.js
//lightbox code
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
import {stripeToken} from 'public/stripe.js';
import wixData from 'wix-data';
import wixUsers from 'wix-users';
import {createCustomer, createSubscription} from 'backend/stripeProcessor.jsw';
$w.onReady(function () {