Skip to content

Instantly share code, notes, and snippets.

View Tusko's full-sized avatar

Tusko Trush Tusko

View GitHub Profile
@Tusko
Tusko / checkbox.scss
Last active September 26, 2023 13:45
css checkbox
View checkbox.scss
.input-checkbox {
border : 1px solid map-get($colors, 'ocean');
position : relative;
transition-duration : 200ms;
-webkit-appearance : none;
appearance : none;
width : 24px;
height : 24px;
&::after {
transition-duration : 100ms;
@Tusko
Tusko / readme.md
Created August 16, 2023 15:29
readme.md
View readme.md
@Tusko
Tusko / ssr-sitemap.js
Last active August 10, 2023 12:39
Vite Plugin SSR Sitemap
View ssr-sitemap.js
import { SitemapStream } from "sitemap";
import { createWriteStream } from "node:fs";
import { resolve } from "node:path";
export function ssrSitemap(opts) {
const pages = new Set();
let config;
let hasVitePlusinSSR = false;
const defaultOtps = {
@Tusko
Tusko / .htaccess
Created May 5, 2023 08:13
Force SSL .htaccess
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
@Tusko
Tusko / .zshrc
Created July 11, 2022 07:16
ZSH NVM autoswitch
View .zshrc
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
@Tusko
Tusko / backdrop.css
Created June 13, 2022 07:50
blue background
View backdrop.css
.element {
backdrop-filter: saturate(50%) blur(8px);
-webkit-backdrop-filter: saturate(50%) blur(8px);
}
@Tusko
Tusko / functions.php
Created June 4, 2021 11:04
Get access by product SKU for Woocommerce
View functions.php
<?php
//place code in the end of functions.php in theme
add_action('template_redirect', 'wc_sku_redirect');
function wc_sku_redirect() {
$parseUrl = explode('/', $wp->request);
if(isset($parseUrl[0]) && $parseUrl[0] === 'product') {
$pid = wc_get_product_id_by_sku($parseUrl[1]);
if($pid) {
wp_safe_redirect(get_permalink($pid));
exit;
@Tusko
Tusko / example.json
Created March 18, 2021 10:28
Woocommerce import from json
View example.json
[
{
"id": "new24",
"category_id": "new-category",
"category_name": "Моя нова категорія",
"category_published": true,
"name": "Новий товар lab24",
"private": false,
"price": 199,
"pricelist": [
@Tusko
Tusko / LICENSE
Created September 2, 2020 11:15 — forked from engelfrost/LICENSE
Fake localStorage. Useful for Safari Private Browsing and browsers that don't implement localStorage.
View LICENSE
The MIT License (MIT)
Copyright (c) 2015 Textalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Tusko
Tusko / header.php
Last active March 21, 2020 11:40
ACF tel button output
View header.php
<?php
$tel = get_field( 'tel', 'options' );
echo $tel ? '<a class="header-tel" href="tel:' . preg_replace( "/[^0-9+]/", "", $tel ) . '">' . $tel . '</a>' : '';