Skip to content

Instantly share code, notes, and snippets.

View anova's full-sized avatar

Necat Bolpaça anova

View GitHub Profile
@anova
anova / scroll-to-section.js
Created July 28, 2025 14:58
Scrolls to section with smooth animation.
window.scrollToSection = function(where) {
const headerHeight = document.getElementById('header-navigation').offsetHeight,
offsetTop = document.getElementById(where).offsetTop,
scrollDistance = offsetTop - headerHeight;
window.scrollTo({top: scrollDistance, behavior: 'smooth' });
};
@anova
anova / gutenberg.md
Last active July 21, 2025 18:58
Cline rule for Gutenberg creation from static file.

Gutenberg Block Creation Rules

This document provides comprehensive rules for creating WordPress Gutenberg blocks in the Example project.

Block Structure Template

Every Gutenberg block follows this basic structure:

import { registerBlockType } from '@wordpress/blocks';
@anova
anova / page.csv-feed-pinterest.liquid
Created January 20, 2025 08:28
Shopify Pinterest CSV feed template. In theme-name\templates\ folder.
{% layout none -%}"id","item_group_id","title","description","link","image_link","price","availability","condition"{{- '' }}
{%- paginate collections.all.products by 2000 -%}
{%- for product in collections.all.products -%}
{%- for variant in product.variants -%}
"{{ variant.id }}","{{ product.id }}","{{ product.title | strip_html | strip_newlines | escape -}}{%- if product.variants.size > 1 %} - {{ variant.title | strip_html | strip_newlines | escape }}{% endif %}","{{- product.description | strip_html | strip_newlines -}}","{{ shop.url -}}{{- variant.url }}","https:{{- variant.featured_image | default: product.featured_image | img_url: '400x' -}}","{{ product.price | money_without_currency | replace: "TL", "TRY" }}","{%- if product.available -%}in stock{%- else -%}out of stock{%- endif -%}","new"{{- '' }}
{%- endfor -%}
{%- endfor -%}
{%- endpaginate -%}
{% comment %}
https://auglio.com/en/knowledge-base/article/20-xml-product-feed-for-shopify-stores
@anova
anova / phone_number_format.js
Last active June 14, 2024 07:54
Format phone number for Turkey (+90) and strip parantheses and spaces.
function () {
if (!document.querySelector('#telefon') || 0 === document.querySelector('#telefon').value.length) {
return null;
}
var phone = '+90' + document.querySelector('#telefon').value.replace(/[\(|\)|\s]/g,'');
//+905551234567 -> 13 karakter
if (13 < phone.length) {
return null;
}
return phone;
@anova
anova / init.lua
Last active February 23, 2024 07:43
My initial neovim plugins and theme
-- vim: set autoindent expandtab shiftwidth=2 tabstop=2:
-- :PlugInstall
-- vim-plug https://github.com/junegunn/vim-plug
local vim = vim
local Plug = vim.fn['plug#']
local PlugBegin = vim.fn['plug#begin']
local PlugEnd = vim.fn['plug#end']
vim.cmd [[language en]]
const { PurgeCSSPlugin } = require("purgecss-webpack-plugin");
const glob = require("glob-all");
// https://stackoverflow.com/a/77249323/181295
module.exports = {
plugins: [
new PurgeCSSPlugin({
defaultExtractor: (content) => {
const defaultSelectors = content.match(/[A-Za-z0-9_-]+/g) || [];
const extendedSelectors = content.match(/[^<>"=\s]+/g) || [];
@anova
anova / web.config
Created November 1, 2023 11:22
web.config www and ssl enforce
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect to www" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
@anova
anova / FAQPage-structured-rich-results.html
Created August 25, 2023 12:27
Sample HTML Structure for FAQPage Google Rich Results. https://search.google.com/test/rich-results
<!doctype html>
<html lang="tr" itemscope itemtype="https://schema.org/FAQPage">
<body>
<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<h2 itemprop="name">Sample Question 1?</h2>
<div itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer">
<div itemprop="text">
<p>Answer example 1</p>
</div>
</div>
@anova
anova / custom-scrollbar.css
Created August 11, 2023 09:30
Custom scrollbar example
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-thumb {
background-color: black;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 2px gray;
@anova
anova / .htaccess
Created August 9, 2023 13:23
Enforce SSL and www with one redirect. Change example.com with your domain.
# https://stackoverflow.com/a/36986520
RewriteEngine On
RewriteCond %{HTTP_HOST} example\.com$
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.example.com%{REQUEST_URI} [L,R=301]