Skip to content

Instantly share code, notes, and snippets.

@sanrandry
sanrandry / nginx_sites-available_folder_not_found.md
Last active February 20, 2024 00:21
nginx sites-available folder not found

nginx sites-available folder not found

create the sites-available and sites-enabled folder

sudo mkdir /etc/nginx/sites-available
sudo mkdir /etc/nginx/sites-enabled

edit the http block inside /etc/nginx/nginx.conf and add this line

include /etc/nginx/sites-enabled/*;
@sanrandry
sanrandry / wordpress_custom_widget.md
Created October 28, 2020 07:58
wordpress custom widget

create wordpress custom widget

add this code to you function.php file

create the custom widget class

frist create a custom widget class that extend the default wordpress widget class this code is from the official wordpress code reference

class My_Widget extends WP_Widget {

	/**
	 * Sets up the widgets name etc
@sanrandry
sanrandry / caculate_navbar_height.md
Last active September 19, 2023 15:24
calculate navbar height
  • add this javascript
document.documentElement.style.setProperty('--nav-height', document.getElementById("navbar").offsetHeight);
  • use property iny css
:root {
    --nav-height: 70px; /*You HAVE To Give A Default Fallback Value*/
}
@sanrandry
sanrandry / wordpress_nav_walker.md
Last active May 29, 2023 17:38
wordpress nav walker

wordpress nav walker

create a walker.php file

create a walker.php file or what ever the name is, its not matter. Then create a class who extend the default wordpress Walker_Nav_Menu

class My_Custom_Walker extends Walker_Nav_Menu {

}

overwrite some method

@sanrandry
sanrandry / note.md
Last active November 23, 2022 06:20
Debian mico noise canceling pulse audion

Debian micro noise canceling pulse audio

Add this line to /etc/pulse/default.pa

load-module module-echo-cancel source_name=noechosource sink_name=noechosink
set-default-source noechosource
set-default-sink noechosink

restart pulse audio

@sanrandry
sanrandry / change local folder git config.md
Last active November 1, 2022 09:10
change local folder git config

Go to the folder you want to change the git config

cd YourFlolder

If you need to change the name

git config user.name "Your name"
@sanrandry
sanrandry / clean_code.md
Created September 2, 2022 15:01 — forked from cedrickchee/clean_code.md
Summary of "Clean Code" by Robert C. Martin

Summary of "Clean Code" by Robert C. Martin

A summary of the main ideas from the "Clean Code: A Handbook of Agile Software Craftsmanship" book by Robert C. Martin (aka. Uncle Bob).

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

@sanrandry
sanrandry / clean_code.md
Created September 2, 2022 14:57 — forked from wojteklu/clean_code.md
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

@sanrandry
sanrandry / Disable wyland for skype or screen sharing error.md
Last active March 10, 2022 08:29
Disable wyland for skype or screen sharing error

Disable wyland for skype or screen sharing error

cd /etc/gdm3/
sudo vim daemon.conf

unocoment the line: WaylandEnable=false

@sanrandry
sanrandry / note.md
Created March 8, 2022 07:00
add current git branch to a bash terminal