Skip to content

Instantly share code, notes, and snippets.

View pvaladez's full-sized avatar

Peter Valadez pvaladez

View GitHub Profile
@pvaladez
pvaladez / apple-silicon-stencil-notes.md
Last active July 1, 2025 00:28
Apple Silicon Node & Stencil CLI Notes

Rosetta

  • Install rosetta: softwareupdate --install-rosetta

  • To check architecture mode in shell: arch

    • x86_64/x64 mode: i386

    • arm64 mode: arm64

@pvaladez
pvaladez / route.ts
Created August 24, 2024 21:32
Catalyst Revalidate API Route Handler
// app/api/revalidate/route.ts
import crypto from 'crypto';
import { revalidatePath } from 'next/cache';
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';
export const dynamic = 'force-dynamic';
export async function GET(request: NextRequest) {
@pvaladez
pvaladez / revalidate.ts
Last active December 16, 2024 19:13
Payload CMS revalidatePost
// src/payload/utilities/revalidate.ts
import type { Payload } from 'payload';
export const revalidate = async (args: {
slug: string;
payload: Payload;
}): Promise<void> => {
const { payload, slug } = args;
@pvaladez
pvaladez / blog-posts.json
Last active July 17, 2025 08:38
Payload CMS Seed Script
{
"blog_posts": [
{
"title": "Why obundle is Your Top Choice for BigCommerce Development",
"content": "In 2024, having a robust and scalable eCommerce platform is essential for business success. obundle, with its deep expertise in BigCommerce development, stands out as a leader in this space. Our team of seasoned developers understands the intricacies of the BigCommerce platform, ensuring that your store is not only functional but also optimized for performance. We offer tailored solutions that cater to your unique business needs, whether you’re a small startup or a large enterprise. With obundle, you’re not just getting a development service; you’re gaining a partner committed to helping your business thrive in the competitive eCommerce landscape.",
"shortDescription": "Discover why obundle is the top choice for BigCommerce development in 2024.",
"thumbnailImage": {
"url": "https://cdn11.bigcommerce.com/s-5unmz/images/stencil/original/image-manager/pexels-www-erzetich-co
@pvaladez
pvaladez / Blogs.ts
Last active August 23, 2024 19:30
Payload CMS Blog Collection Schema
import type { CollectionConfig } from 'payload'
import { anyone } from '@/payload/access/anyone'
import { authenticated } from '@/payload/access/authenticated'
import { slugField } from '@/payload/fields/slug'
export const BlogPosts: CollectionConfig = {
slug: 'blog-posts',
admin: {
useAsTitle: 'title',
@pvaladez
pvaladez / CustomGroupFieldComponent.tsx
Created June 29, 2024 06:26
Payload CMS Custom Group Field with Ability to Hide Label
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ErrorPill } from 'payload/components';
import type { Props } from 'payload/components/fields/Group';
import {
createNestedFieldPath,
FieldDescription,
RenderFields,
useFormSubmitted,
} from 'payload/components/forms';
@pvaladez
pvaladez / nvmCommands.js
Created December 4, 2023 22:52 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@pvaladez
pvaladez / 00-README-NEXT-SPA.md
Created May 10, 2023 04:07 — forked from gaearon/00-README-NEXT-SPA.md
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.