This file contains 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
export const power = (x, y) => { | |
if (y < 0) { | |
throw new Error( | |
'exponent must be greater than or equal to 0 (for the purposes of this example)' | |
); | |
} | |
if (y === 0) { | |
return 1; | |
} |
This file contains 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
export const factorial = (x) => { | |
if (x < 0) { | |
throw new Error('x must be greater than or equal to 0'); | |
} | |
if (x <= 1) { | |
return 1; | |
} | |
return x * factorial(x - 1); |
This file contains 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
export const factorial = (x) => { | |
if (x < 0) { | |
throw new Error('x must be greater than or equal to 0'); | |
} | |
if (x <= 1) { | |
return 1; | |
} | |
let result = 1; |
This file contains 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, { useEffect, useState } from 'react'; | |
import Web3 from 'web3'; | |
import Contract from 'web3-eth-contract'; | |
import CoinbaseWalletSDK from '@coinbase/wallet-sdk'; | |
import CrowdfundingContract from './contracts/Crowdfunding.json'; | |
import elon from './elon.jpg'; | |
import './App.css'; | |
const APP_NAME = 'Coinbase Crowdfunding App'; | |
const APP_LOGO_URL = './elon.jpg'; |
This file contains 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
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity ^0.8.13; | |
/*********************************/ | |
/* Learning Purposes ONLY */ | |
/* DO NOT USE IN PRODUCTION */ | |
/*********************************/ | |
contract Crowdfunding { | |
uint256 fundGoal = 10 ether; |
This file contains 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 format = require('date-fns/format'); | |
const express = require('express'); | |
const router = express.Router(); | |
router.get('/', function (req, res) { | |
if (!req.query.birthday) { | |
return res.json({ data: 'Please provide your birthdate' }); | |
} |
This file contains 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 format = require('date-fns/format'); | |
const express = require('express'); | |
const router = express.Router(); | |
router.get('/', function (req, res) { | |
if (!req.query.birthday) { | |
return res.json({ data: 'Please provide your birthdate' }); | |
} |
This file contains 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 notifier = require('node-notifier'); | |
const path = require('path'); | |
module.exports.requestGroupActions = [ | |
{ | |
label: 'Send All Requests', | |
action: async (context, data) => { | |
const { requests } = data; | |
for (const request of requests) { |
This file contains 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 addFormSubmissionEventListener = (collectContainer) => { | |
const submitCreditCardForm = (e) => { | |
e.preventDefault(); | |
const resultContainer = document.querySelector('#result'); | |
const collectResponse = collectContainer.collect(); | |
collectResponse | |
.then((data) => { | |
resultContainer.textContent = `Success! Stored tokenized data with ID: ${data.records[0].fields.skyflow_id}`; | |
resultContainer.classList.remove('hidden'); |
This file contains 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 mountCollectElements = ( | |
cardHolderNameElement, | |
cardNumberElement, | |
expiryDateElement | |
) => { | |
cardHolderNameElement.mount('#collectCardholderName'); | |
cardNumberElement.mount('#collectCardNumber'); | |
expiryDateElement.mount('#collectExpiryDate'); | |
}; |