Skip to content

Instantly share code, notes, and snippets.

View anova's full-sized avatar

Necat Bolpaça anova

View GitHub Profile
@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]
@anova
anova / cjs - search_term (q).js
Created August 8, 2023 11:12
Custom JavaScript Variable for GTM search_term query string
// cjs variable name: cjs - search_term (q)
function() {
var params = new URLSearchParams(window.location.search);
return params.get('q');
}
@anova
anova / createObserver.js
Created November 16, 2022 12:09
creates an Intersection Observer.
/** @return IntersectionObserver */
function createObserver(p_threshold) {
return new IntersectionObserver(
(entries) => {
entries.forEach((/** @type IntersectionObserverEntry */ entry) => {
if (entry.isIntersecting) {
const eventIntersecting = new CustomEvent("intersecting");
entry.target.dispatchEvent(eventIntersecting);
return;
}