Skip to content

Instantly share code, notes, and snippets.

View mrkaluzny's full-sized avatar

Wojciech Kałużny mrkaluzny

View GitHub Profile
.keen-slider__slide {
min-width: calc(100% + 0px);
max-width: calc(100% + 0px);
transform: translate3d(0, 0, 0);
}
@mrkaluzny
mrkaluzny / nginx.conf
Created March 20, 2023 09:25
nginx - cache for static resources
location ~* \.(jpg|jpeg|png|gif|ico|svg|woff|woff2|css|js|webp)$ {
expires 365d;
}
@mrkaluzny
mrkaluzny / useExperiment.js
Created February 17, 2023 15:38
React/Next.js Google Optimize A/B Test implementation Hook
import { useEffect, useState } from "react";
const useExperiment = (
experimentId,
defaultVariant,
event = "optimize.activate"
) => {
const [variant, setVariant] = useState(defaultVariant);
useEffect(() => {
if (window.dataLayer) {
@mrkaluzny
mrkaluzny / migration.sql
Last active December 7, 2022 17:49
Remove duplicate stock from WooCommerce
DELETE pm1
FROM wp_postmeta pm1,
wp_postmeta pm2
WHERE
pm1.meta_key = '_stock'
AND pm2.meta_key = '_stock'
AND pm1.post_id = pm2.post_id
AND pm1.meta_id < pm2.meta_id
@mrkaluzny
mrkaluzny / woocommerce-popularity-last-30-days.php
Created May 13, 2022 15:56
WooCommerce -> Popularity custom sorting based on last 30days of sales
<?php
if (!wp_next_scheduled('set_last_month_product_sales_hook')) {
wp_schedule_event(time(), 'daily', 'set_last_month_product_sales_hook');
}
add_action('set_last_month_product_sales_hook', 'cc_set_last_month_sales');
function cc_set_last_month_sales()
{
@mrkaluzny
mrkaluzny / GatsbySearch.js
Created November 4, 2020 17:15
Search Component - Gatsby and Flex Search
import React, { Component } from 'react'
import ReactSVG from 'react-svg'
import ResultItem from '@/components/Search/Result'
export default class Search extends Component {
constructor(props) {
super(props)
this.state = {
results: [],
isSearchbarVisible: false,
@mrkaluzny
mrkaluzny / Drag & Drop Multiple File Upload CF7 Global Function
Last active March 17, 2020 11:20
Attach initiate function to window and call it from anywhere for dynamic forms
jQuery(document).ready(function($){
// Fires when an Ajax form submission has completed successfully, and mail has been sent.
document.addEventListener( 'wpcf7mailsent', function( event ) {
// Get input type file element
var inputFile = $('.wpcf7-drag-n-drop-file');
// Reset upload list for multiple fields
if( inputFile.length > 0 ) {
@mrkaluzny
mrkaluzny / typography.scss
Created May 28, 2019 10:32
AngelsTeach Titles
// Colors
$brand-primary: #27ae60;
$fa-font-path: '~font-awesome/fonts';
$brand-white: #fff;
$brand-grey: #929095;
$brand-violet: #5d0e8b;
$brand-violet-link: #5d2c85;
$brand-violet-light: #8d1179;
$brand-violet-button: #c114a2;
$brand-violet-active: #b63293;
@mrkaluzny
mrkaluzny / CustomPostTypeLoopwithTaxonomy.php
Last active August 14, 2017 13:54
WordPress Custom Post Type Loop with Taxonomies categorization on page.
<?php
// Setting up the query
$post_type_name = 'faculty';
$taxonomy_name = 'faculty-type';
$terms_arr = get_terms($taxonomy_name);
$terms_to_loop = returnTermsSlug($terms_arr);
function returnTermsSlug($termsArr) {
$a = [];
foreach ($termsArr as $term) {
@mrkaluzny
mrkaluzny / Brief_Template.md
Last active September 7, 2016 11:49
Brief template for web design & development services

Brief Template

1 Introduction

Deadline, contact information for person responsible for the project on client side.

2 Enterprise description

What services are provided by the client? What kind of products it offers? What is the business’ mission and values?