Skip to content

Instantly share code, notes, and snippets.

View roybarber's full-sized avatar

Roy Barber roybarber

View GitHub Profile
<!--Kontakt-->
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Titel</title>
</head>
<body>
<h1>Platzhalter Nummer 1</h1>
<!--Konto erstellen-->
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Titel</title>
</head>
<body>
<h1>Platzhalter Nummer 1</h1>
@roybarber
roybarber / makeRequest.js
Created December 17, 2021 15:32
Reusable ES6 Javascript API module using Axios - Promise
//////////////////////////////////////
// Generic service like function for
// Api requests using axios
// @param {String} url - api url
// @param {String} method - E.g POST, GET
// @param {Body} body - form body if needed
// @returns {Promise} data
//////////////////////////////////////
export const makeRequest = (url, method, body) => {
url = encodeURI(url)
@roybarber
roybarber / safe-actions.ts
Last active October 3, 2024 09:11
Next.js + Vercel Firewall - Rate Limit
import { unstable_checkRateLimit as checkRateLimit } from '@vercel/firewall'
import { DEFAULT_SERVER_ERROR_MESSAGE, createSafeActionClient,} from 'next-safe-action'
import { headers } from 'next/headers'
// Creating an action client using the createSafeActionClient function
export const actionClient = createSafeActionClient({
// Handling returned server errors
handleReturnedServerError(e) {
// If the error is an instance of Error, return its message
if (e instanceof Error) {