Skip to content

Instantly share code, notes, and snippets.

View zarei-dev's full-sized avatar
💻
Focusing

Mohammad Zarei zarei-dev

💻
Focusing
View GitHub Profile
@cameronjonesweb
cameronjonesweb / 404-fix.php
Created May 1, 2021 01:00
Fix 404 pages returning true for have_posts if permalinks have a prefix ie "/news/%postname/"
<?php
function cameronjonesweb_404_fix() {
global $wp_query;
if ( $wp_query->is_404 ) {
$wp_query->posts = array();
$wp_query->current_post = 0;
$wp_query->post = null;
}
}
@ChriRas
ChriRas / readme.md
Last active June 4, 2024 18:47
Set up default audio device on Ubuntu 20.04 LTS

Problem

I have a notebook connected to a port replicator. I want to use the build-in speakers and microfone and not the external ones. If I boot my notebook in my port replicator Ubuntu changes the devices to external.

Solution

  1. Find your internal speaker
pactl list short sinks
@vonschnappi
vonschnappi / jenkins-pipeline-get-commit-message.groovy
Created January 10, 2018 12:29
Getting the commit message when running a Jenkins pipeline job
commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
String commitMsg = ""
List commitMsgPre = commit.split(" ")
for(int i=1; i<commitMsgPre.size(); i++){
commitMsg += commitMsgPre.getAt(i) + " "
}
@wojteklu
wojteklu / clean_code.md
Last active June 20, 2024 21:37
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@birgire
birgire / woo-product-attributes-bulk-modifier.php
Last active June 6, 2024 13:30
WordPress: WooCommerce Product Attributes - Bulk Modifier ( from custom meta attributes to taxonomy attributes)
<?php
/**
* Plugin Name: WooPAM: Woo Product Attributes Modifier
* Description: Bulk update 'custom meta product attributes' to 'taxonomy product attributes' in WooCommerce. Supports the GET variables, like: woopam_mode=run&woopam_from_attribute_meta=colour&woopam_to_attribute_tax=pa_colour&woopam_keep_attribute_meta&woopam_posts_per_page=10&woopam_paged=0&woopam_post_type=product&woopam_post_status=any. WARNING: Backup DB first!!!
* Plugin Author: birgire
* Author URI: https://github.com/birgire
* Plugin URI: https://gist.github.com/birgire/0ed300ae4436fcaf508c
* Version: 1.0.0
* License: GPL2+
* Text Domain: woopam
@djaiss
djaiss / gist:2938259
Created June 15, 2012 19:13
PHP List of countries
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",