View contact.js
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 TextField from '@mui/material/TextField'; | |
import Button from '@mui/material/Button'; | |
import {useState} from 'react'; | |
export default function Contact() { | |
const [send, setSend] = useState(false); | |
async function handleSubmit(event) { | |
event.preventDefault() |
View email.js
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 sendInBlueKey = process.env.NEXT_PUBLIC_SEND_IN_BLUE_KEY | |
export default async function handler(req, res) { | |
const body = req.body | |
const resp = await fetch('https://api.sendinblue.com/v3/smtp/email', { | |
method: 'POST', | |
headers: { | |
'Accept': 'application/json', |
View render.js
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 ReactMarkdown from 'react-markdown'; | |
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; | |
import { materialDark } from "react-syntax-highlighter/dist/cjs/styles/prism"; | |
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"; | |
<ReactMarkdown | |
components={{ | |
p: ({ node, children }) => { | |
if (node.children[0].tagName === "img") { | |
const image = node.children[0]; |
View netlify.toml
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
[functions] | |
included_files = ["netlify/functions/**"] |
View packakge.json
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
{ | |
"scripts": { | |
"generate": "run-func netlify/functions/header.js handler" | |
}, | |
"dependencies": { | |
"axios": "^0.24.0", | |
"jimp": "^0.16.1", | |
"rss-to-json": "^2.0.2", | |
"run-func": "^1.0.5", | |
"sharp": "^0.29.3", |
View header.js
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 { TwitterClient } = require('twitter-api-client') | |
const axios = require('axios') | |
const sharp = require('sharp') | |
const Feed = require('rss-to-json') | |
const Jimp = require('jimp') | |
const fs = require('fs') | |
const numberOfFollowers = 3 | |
const widthHeightFollowerImage = 90 |
View test.js
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
getDataCached('a').then(result => { console.log('first call outer: ' + result); | |
getDataCached('a').then(result => { console.log('first call inner: ' + result); }); | |
}); | |
getDataCached('b').then(result => { console.log('first call outer: ' + result); | |
getDataCached('b').then(result => { console.log('first call inner: ' + result); }); | |
}); | |
getDataCached('a').then(result => { console.log('second call outer: ' + result); | |
getDataCached('a').then(result => { console.log('second call inner: ' + result); }); |
View ttl.js
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 now = new Date().getTime(); | |
if (_cacheResolvedTime.has(key)) { | |
if ((now - _cacheResolvedTime.get(key)) > 60000) { | |
_cacheResolvedTime.delete(param); | |
_cacheValues.delete(key); | |
_cachePromises.delete(key); | |
} | |
} |
View cache.js
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
if (_cacheValues.has(key)) { | |
return Promise.resolve(_cacheValues.get(key)); | |
} else if (_cachePromises.has(key)) { | |
return _cachePromises.get(key); | |
} else { | |
const promise = new Promise(function (resolve, reject) { | |
return getData(key).then(data => { | |
_cacheValues.set(key, data); | |
_cachePromises.delete(key); | |
const now = new Date().getTime(); |
View variables.js
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 _cacheValues = new Map(); | |
const _cacheResolvedTime = new Map(); | |
const _cachePromises = new Map(); | |
const getDataCached = function (key) { | |
} |
NewerOlder