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 axios, { AxiosInstance, AxiosResponse } from 'axios' | |
| // ----------------------------------------------------------------------------- | |
| // Constants | |
| // ----------------------------------------------------------------------------- | |
| const TOKEN_EXPIRY = { | |
| ACCESS_TOKEN: 1800, | |
| REFRESH_TOKEN: 2592000, | |
| } as const |
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 fs from "fs/promises"; | |
| import path from "path"; | |
| import { env } from "@/libs/env/server"; | |
| import { AppStoreServerAPIClient, Environment, SignedDataVerifier } from "@apple/app-store-server-library"; | |
| const loadRootCertificate = async () => { | |
| const certificatesDirectory = path.join(process.cwd(), "./apple-root-certificates"); | |
| return Promise.all([ | |
| fs.readFile(path.join(certificatesDirectory, "./cert-1.cer")), |
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 LOG_TAG = ""; | |
| export default function handle(req, res) { | |
| try { | |
| const { method, body, query } = req; | |
| switch (method) { | |
| case "GET": { | |
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 Router from "next/router"; | |
| // How to refresh server data without reloading the page | |
| // https://www.joshwcomeau.com/nextjs/refreshing-server-side-props/ | |
| // https://twitter.com/flybayer/status/1333081016995622914 | |
| export function refetchPageData(path: string) { | |
| return new Promise<void>((res, rej) => { | |
| Router.events.on("routeChangeComplete", () => { | |
| res(); |
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
| function addUpPrimes(n) { | |
| // using the seive of Eratosthenes get all primes | |
| const list = []; | |
| for (let i = 2; i <= n; i++) { | |
| list[i] = { index: i, value: true }; | |
| } | |
| // our limit | |
| const limit = Math.sqrt(n); |
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 Modules | |
| import numeral from 'numeral'; | |
| import fetch from 'isomorphic-fetch'; | |
| const cc = require('cryptocompare'); | |
| // Fetch currency functions | |
| const get_currency = async (currency, url) => { | |
| // Helper function that gets currency quantity and formats the result | |
| try { | |
| const response = await fetch(url); |
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
| /** | |
| * ./src/components/post/view/topbar | |
| */ | |
| import React, { Component } from 'react'; | |
| import PropTypes from 'prop-types'; | |
| import { Link } from 'react-router-dom'; | |
| import { connect } from 'react-redux'; | |
| import { logoutUser } from '../../js/redux/actions'; | |
| import img from '../../img/default-pic.png'; |