Skip to content

Instantly share code, notes, and snippets.

@iamlos
iamlos / wordpress-nextjs-integration-guide.md
Created March 19, 2025 09:39
Prompt: Implementing WordPress as a Headless CMS in a Next.js Application

Implementing WordPress as a Headless CMS in a Next.js Application

This guide provides step-by-step instructions for implementing WordPress as a headless CMS in a Next.js application using Faust.js and GraphQL. This approach allows you to use WordPress for content management while leveraging Next.js for the frontend.

Prerequisites

  • A WordPress site with admin access
  • Node.js and npm/yarn installed
  • Basic knowledge of React and Next.js
  • Basic understanding of GraphQL
@iamlos
iamlos / index.tsx
Created March 13, 2025 08:52 — forked from bonface221/index.tsx
Framer motion animated counter up while component is in view in next js. For react remove use client and props
"use client";
import {
animate,
motion,
useInView,
useMotionValue,
useTransform,
} from "framer-motion";
import { useEffect, useRef } from "react";
@iamlos
iamlos / vpn_install.sh
Created January 10, 2025 20:27 — forked from ig-rudenko/vpn_install.sh
Для установки нового VPN сервера
#!/bin/bash
if [ "${EUID}" -ne 0 ]; then
echo "You need to run this script as root"
exit 1
fi
# Добавляем официальные репозитории для ubuntu 20.04 LTS
echo "deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
@iamlos
iamlos / harden_ubuntu.sh
Created January 10, 2025 19:16 — forked from renier/harden_ubuntu.sh
Harden Ubuntu
#!/bin/bash
apt-get update
apt-get upgrade -y
apt-get autoremove -y
apt-get autoclean -y
apt-get install ufw -y
apt-get install denyhosts -y
# Configure firewall
@iamlos
iamlos / form.txt
Created December 31, 2024 05:48
Optout_form_california-rights
<div id="comp-kg4tm0vl" class="bkIuWA comp-kg4tm0vl"><div data-mesh-id="comp-kg4tm0vlinlineContent" data-testid="inline-content" class=""><div data-mesh-id="comp-kg4tm0vlinlineContent-gridContainer" data-testid="mesh-container-content"><form id="comp-kg4tm0x41" class="JVi7i2 comp-kg4tm0x41 wixui-form"><div data-mesh-id="comp-kg4tm0x41inlineContent" data-testid="inline-content" class=""><div data-mesh-id="comp-kg4tm0x41inlineContent-gridContainer" data-testid="mesh-container-content"><div id="comp-kg4tm0xw" class="HcOXKn SxM0TO QxJLC3 lq2cno YQcXTT comp-kg4tm0xw wixui-rich-text" data-testid="richTextElement"><h5 class="font_5 wixui-rich-text__text" style="font-size:20px;"><span class="color_11 wixui-rich-text__text"><span style="font-size:20px;" class="wixui-rich-text__text"><span style="font-family:montserrat,sans-serif;" class="wixui-rich-text__text">Data subject rights request</span></span></span></h5></div><div id="comp-kg4tm0xz" class="MpKiNN comp-kg4tm0xz wixui-text-input lPl_oN LyB02C" tabindex="-1"><di
@iamlos
iamlos / block.json
Created December 14, 2024 11:23 — forked from carlodaniele/block.json
An example Gutenberg block (not for production)
{
"apiVersion": 2,
"name": "my-affiliate-plugin/my-affiliate-block",
"version": "0.1.0",
"title": "Affiliate Block",
"category": "design",
"icon": "money",
"keywords": [ "kinsta", "affiliate", "money" ],
"description": "An example block for Kinsta readers",
"supports": {
<?php
/**
* @package Smashing_plugin
* @version 1.0
*/
/*
Plugin Name: Smashing plugin
Plugin URI: https://www.smashingmagazine.com/2016/03/advanced-wordpress-search-with-wp_query/
Description: This is an example plugin for Smashing Magazine readers.
Author: Carlo Daniele
@iamlos
iamlos / gutenberg.txt
Created December 14, 2024 11:21 — forked from chrismccoy/gutenberg.txt
Gutenberg Resources
Eliminate All Blocks from Editor
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]);
Filtering Blocks When allowed_block_types_all is a boolean
https://tomjn.com/2024/02/29/filtering-blocks-when-allowed_block_types_all-is-a-boolean/
Gutenberg / Block editor: Dynamically populate SelectControl, RadioControl or CheckboxControl options
https://bdwm.be/gutenberg-block-editor-dynamically-populate-selectcontrol-radiocontrol-or-checkboxcontrol-options/
Gutenberg: custom validation / how to prevent post from being saved
@iamlos
iamlos / register-post-type.php
Created December 14, 2024 10:41 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public