Skip to content

Instantly share code, notes, and snippets.

@ivanfgm
ivanfgm / launch.json
Created February 10, 2021 02:56
VSCode's launch.json for Next.js, tested on: 1.54.0-insider
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Start",
"runtimeExecutable": "${workspaceFolder}/node_modules/next/dist/bin/next",
"env": {
"NODE_OPTIONS": "--inspect"
@ivanfgm
ivanfgm / cf7-recaptcha-v3.php
Created June 1, 2021 20:40
Validate a recaptcha token with wordpress plugin contact form 7, useful when integrating with a custom frontend.
<?php
/* Verificacion especial recaptcha - cf7 */
add_filter('wpcf7_spam', function ($spam) {
if ($spam) {
return $spam;
}
@ivanfgm
ivanfgm / firebaseAdmin.js
Created March 17, 2022 20:56
Use Firebase Admin SDK inside a Next.js project.
// I usually put this in config/firebaseAdmin.js
import * as admin from 'firebase-admin'
// You need your account service key json file inlined in .env
let serviceAccount = JSON.parse(process.env.FIREBASE_ACCOUNTKEY)
let config = {
credential: admin.credential.cert(serviceAccount)
}
export default !admin.apps.length ? admin.initializeApp(config) : admin;