Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kirill Korveld

🏠
Working from home
  • Ukraine
View GitHub Profile
@Korveld
Korveld / Import an SQL file using the command line in MySQL
Created Aug 31, 2022
Import an SQL file using the command line in MySQL
View Import an SQL file using the command line in MySQL
mysql -u [DATABASE USER] -p [DATABASE NAME] < [PATH TO SQL FILE]
@Korveld
Korveld / gulpfile.js
Created Aug 5, 2022 — forked from BaronVonPerko/gulpfile.js
Gulpfile for SCSS and Tailwind
View gulpfile.js
var gulp = require('gulp');
var sass = require('gulp-sass');
var postcss = require('gulp-postcss');
gulp.task('style', function () {
var tailwindcss = require('tailwindcss');
return gulp.src('sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(postcss([
@Korveld
Korveld / Wordpress Disable Lazy Load
Created Jul 24, 2022
Wordpress Disable Lazy Load
View Wordpress Disable Lazy Load
add_filter( 'wp_lazy_loading_enabled', '__return_false' );
@Korveld
Korveld / resize-event.vue
Created Jul 19, 2022 — forked from ansidev/resize-event.vue
Handle resize event in Nuxt JS
View resize-event.vue
<script>
export default {
mounted: function () {
this.$nextTick(function () {
this.onResize();
})
window.addEventListener('resize', this.onResize)
},
methods: {
onResize() {
@Korveld
Korveld / Wordpress redirection get all urls except a couple
Created Jul 8, 2022
Wordpress redirection get all urls except a couple
View Wordpress redirection get all urls except a couple
^/lt/blog/(?!some-slug-one|some-slug-two)(.*)
View yoast_seo_canonical_change_woocom_shop.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change the canonical link for the shop page
* Credit: Scott Weiss of somethumb.com
* Last Tested: Jan 25 2017 using Yoast SEO 6.0 on WordPress 4.9.1
*/
function yoast_seo_canonical_change_woocom_shop( $canonical ) {
if ( !is_shop() ) {
@Korveld
Korveld / Redirect all pages to non-www and HTTPS in WordPress
Created Dec 20, 2021
Redirect all pages to non-www and HTTPS in WordPress
View Redirect all pages to non-www and HTTPS in WordPress
# BEGIN Redirects
RewriteEngine On
# 301 redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# 301 redirect to https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# END Redirects
@Korveld
Korveld / JS Check if Function Exists Before Calling
Created Nov 26, 2021
JS Check if Function Exists Before Calling
View JS Check if Function Exists Before Calling
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}
@Korveld
Korveld / Woocommerce show top sale products
Created Oct 28, 2021
Woocommerce show top sale products
View Woocommerce show top sale products
<?php echo do_shortcode('[best_selling_products per_page="12" orderby="popularity" order="DESC"]'); ?>
OR
<?php
$args = array(
'post_type' => 'product',
'meta_key' => 'total_sales',
'orderby' => 'meta_value_num',
'posts_per_page' => 12,