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
import Credentials from "./Credentials"; | |
const axios = require("axios"); | |
const http = axios.create(); // Creates new axios instance | |
const credentials = new Credentials(); // Gets access to all credentials functions | |
http.interceptors.request.use( | |
async config => { | |
const token = await credentials.getCredentials(); // Gets credentials from localStorage | |
if (token) config.headers.Authorization = `Bearer ${token}`; // Inserts credentials as bearer token in request headers |
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.interceptors.response.use( | |
response => { | |
return response; | |
}, | |
error => { | |
if (error.response) { | |
switch (error.response.status) { | |
case 500: | |
return (document.location.href = | |
process.env.REACT_APP_CLIENT_URL + "/500"); |
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
//CheckoutForm.js | |
import React, { Component } from "react"; | |
import { | |
CardNumberElement, | |
CardExpiryElement, | |
CardCVCElement, | |
injectStripe | |
} from "react-stripe-elements"; | |
const axios = require("axios"); | |
class CheckoutForm extends Component { |
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
componentDidMount() { | |
if (window.Stripe) { | |
this.setState({stripe: window.Stripe('pk_test_12345')}); | |
} else { | |
document.querySelector('#stripe-js').addEventListener('load', () => { | |
// Create Stripe instance once Stripe.js loads | |
this.setState({stripe: window.Stripe('pk_test_12345')}); | |
}); | |
} | |
} |
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
// index.js | |
import React from "react"; | |
import { render } from "react-dom"; | |
import {Elements, StripeProvider } from "react-stripe-elements"; | |
import App from "./App.js"; | |
render( | |
<StripeProvider apiKey="pk_test_12345"> | |
<Elements> | |
<App /> | |
</Elements> |
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
cy.get('iframe[name^="__privateStripeFrame5"]').then($iframe => { | |
const $body = $iframe.contents().find("body"); | |
cy.wrap($body) | |
.find('input[name="cardnumber"]') | |
.type("4242424242424242", { delay: 10 }); | |
}); | |
cy.get('iframe[name^="__privateStripeFrame6"]').then($iframe => { | |
const $body = $iframe.contents().find("body"); | |
cy.wrap($body) | |
.find('input[name="exp-date"]') |
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
import React from "react"; | |
const GameInformation = () => { | |
return ( | |
<div className="game-header"> | |
<h1>Rock, Paper, Scissors</h1> | |
<h3>Welcome, the rules are simple:</h3> | |
<ul> | |
{[["ROCK", "SCISSORS"], ["PAPER", "ROCK"], ["SCISSORS", "PAPER"]].map( | |
array => { |
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
class Event < ApplicationRecord | |
validates_presence_of :title, message: "can't be blank" | |
validates_presence_of :description, message: "can't be blank" | |
validates_presence_of :start_date, message: "can't be blank" | |
validates_presence_of :end_date, message: "can't be blank" | |
after_create :create_calendar_event | |
def create_calendar_event |
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
require 'googleauth' | |
require 'google/apis' | |
require 'google/apis/calendar_v3' | |
module GoogleMeetService | |
def self.create_google_event(event) | |
authorize_client | |
google_event = create_calendar_event(event) | |
updated_google_event = update_calendar_event(event,google_event) | |
event.update_attribute(:conference_link,updated_google_event.hangout_link) |
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
language: node_js | |
node_js: | |
- 12 | |
addons: | |
apt: | |
packages: | |
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves | |
- libgconf-2-4 | |
cache: | |
# Caches $HOME/.npm when npm ci is default script command |