Skip to content

Instantly share code, notes, and snippets.

@kanlukasz
kanlukasz / pretty_thunderbird_labels.css
Created Aug 1, 2022 — forked from eriwen/pretty_thunderbird_labels.css
userChrome.css snippet for Thunderbird to have pretty labels
View pretty_thunderbird_labels.css
/* Default Important Label */
treechildren::-moz-tree-cell(lc-FF0000) {
border-bottom: 1px solid #FF0000 !important; background-color: #FFCCCC !important;
}
treechildren::-moz-tree-cell-text(lc-FF0000) {
color: #000000 !important;
}
treechildren::-moz-tree-cell(lc-FF0000, selected) {
background-color: #FF0000 !important;
}
@kanlukasz
kanlukasz / ssh-exit-codes.sh
Created Mar 28, 2022 — forked from asiegman/ssh-exit-codes.sh
Understanding SSH and exit codes in Bash scripts.
View ssh-exit-codes.sh
#!/bin/bash
#
# SSH Exit Codes
#
# Using SSH in scripting is pretty standard, but sometimes you want to stop execution of a script
# if a command inside an SSH session fails to exit cleanly (return 0). The key to remember is that
# the ssh command's exit code will be that of the *last executed* command inside the ssh session, just
# like a bash script ends with the exit code of the last command executed unless you specifically
# call exit.
#
@kanlukasz
kanlukasz / wc-sample-products-loop.php
Created Nov 24, 2021 — forked from woogists/wc-sample-products-loop.php
[Theming Snippets] Sample products loop
View wc-sample-products-loop.php
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
@kanlukasz
kanlukasz / .gitignore
Created Oct 25, 2021 — forked from lukecav/.gitignore
WordPress - GitHub Repo .gitignore example
View .gitignore
# -----------------------------------------------------------------
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
#
# To ignore uncommitted changes in a file that is already tracked, use
# git update-index --assume-unchanged
#
# To stop tracking a file that is currently tracked, use
# git rm --cached
@kanlukasz
kanlukasz / myscript.sh
Created Oct 5, 2021 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
View myscript.sh
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@kanlukasz
kanlukasz / serve-side-block.js
Created Sep 17, 2021 — forked from Shelob9/serve-side-block.js
Example Gutenberg block with server-side rendering. Gutenberg edit() block creates interface. Gutenberg saves settings automatically, the PHP function passed as `render_callback` to `register_block_type` is used to create HTML for front-end rendering of block.
View serve-side-block.js
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const el = wp.element.createElement;
registerBlockType( 'hiRoy/serverSide', {
title: __( 'Server Side Block', 'text-domain' ),
icon: 'networking',
category: 'common',
attributes: {
@kanlukasz
kanlukasz / something.php
Created Sep 17, 2021 — forked from kovshenin/something.php
Yes, you can use printf and sprintf in WordPress too!
View something.php
<?php
// Dirty, easy to miss a ' or " or .
echo '<a href="' . get_permalink() . '" class="link">' . get_the_title() . '</a>';
// Clean, easier to read
printf( '<a href="%s" class="link">%s</a>', get_permalink(), get_the_title() );
// Almost as clean, and more secure, maybe a little paranoic :)
printf( '<a href="%s" class="link">%s</a>', esc_url( get_permalink() ), esc_html( get_the_title() ) );
@kanlukasz
kanlukasz / SSLXampp.md
Created Feb 8, 2020 — forked from nguyenanhtu/SSLXampp.md
Guide to configure SSL in XAMPP for Windows
View SSLXampp.md

How to test 'https' in XAMPP for localhost ? I will guide you

Menu

  • Create certificate
  • Config Apache to access https instead of http
  • Config mod rewrite to generate SSL url
  • Config Virtual host to test site

Step 1 : Create certificate

  • Go to your XAMPP installation directory (in my case it’s E:\xampp), figure out apache folder. In this, find & run batch file
@kanlukasz
kanlukasz / https-on-localhost.md
Created Feb 8, 2020 — forked from adnan360/https-on-localhost.md
Use HTTPS on Localhost (XAMPP, Windows)
View https-on-localhost.md

Sometimes some websites require https to work. This can be useful in those cases.

This has been tested with XAMPP (PHP 7.0.8) on Windows 7. Please see the Reference links at the end if in confusion about some step.

STEP 1: Editing Configs

Open:

C:\xampp\php\php.ini
@kanlukasz
kanlukasz / php.ini
Created Feb 4, 2020 — forked from tomasfejfar/php.ini
Settings to copy to your php.ini to make debugger work. It lists many unnecessary values just in case they were overridden before.
View php.ini
; path to your php_xdebug extension file
; download from https://xdebug.org/wizard.php
zend_extension="c:\xampp-php7\php\ext\php_xdebug-2.4.0-7.0-vc14.dll"
; disables profiler globally
xdebug.profiler_enable = 0
; allows enabling it selectively with request parameter "XDEBUG_PROFILE"
xdebug.profiler_enable_trigger = 1
; directory to output profiler files to
xdebug.profiler_output_dir = "C:\xampp-php7\tmp"
; profiler file name (with request uri and timestamp)