Skip to content

Instantly share code, notes, and snippets.

View ApoGouv's full-sized avatar
🚧
work in progress

Apostolos Gouvalas ApoGouv

🚧
work in progress
View GitHub Profile
@ApoGouv
ApoGouv / js-scripts.md
Created March 28, 2021 05:57
JS scripts for common and not only solutions

jQuery - Add support for passive event listeners

| There is an open issue here: jquery/jquery#2871

// Passive event listeners
jQuery.event.special.touchstart = {
    setup: function( _, ns, handle ) {
 this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
@ApoGouv
ApoGouv / css_crafts.md
Created September 22, 2020 08:43
CSS snippets

Show an indicator and change the horizontal scrollbar styles when using the BootStrap .table-responsive class.

We change the styling of the horizontal scrollbar in our responsive table and also add a text indicating that the user can scroll horizontaly. The Text indicator is only visible in mobile devices.

/* BS Responsive table indicator */
::-webkit-scrollbar {
    height: 6px;            /* height of horizontal scrollbar */
    border: 1px solid #333; /* border of horizontal scrollbar */
    background: #333;       /* bg color of horizontal scrollbar */
@ApoGouv
ApoGouv / pivot-tables.md
Created March 8, 2020 15:01 — forked from Braunson/pivot-tables.md
Laravel 6.x - Diving into Pivot Tables

Laravel 6 - Diving Into Pivot Tables

Pivot tables can be confusing and a little hard to wrap your head around at first. In this quick article we are going to dive into what a pivot table is, how to create one and finally how to use the pivot table. Let's dive in!

What is a pivot table?

A pivot table is used to connect relationships between two tables. Laravel provides a Many To Many relationship where you can use a pivot table.

@ApoGouv
ApoGouv / eureka.md
Created February 8, 2020 07:26
Dev Ideas gathered from varius resources. Attribution/references at the end

Project 0: Contribute to Open Source

If you’re not the type of person that likes doing solo projects, you could always choose to contribute to open source. It might seem scary at first sight but there are lots of projects that could use a little help.

If you don’t feel comfortable enough to submit pieces of code, that’s fine. Contributing can be as simple as checking a pull request.

Pick a project you like and start helping people out!

@ApoGouv
ApoGouv / wc_cart_changes.php
Last active April 5, 2019 06:52
Woocommerce Functions for mods
<?php
/************************************************************************
* Changes the redirect URL for the Return To Shop button in the cart.
***********************************************************************/
function cds_wc_empty_cart_redirect_url() {
return 'https://www.example.gr/some/custom/url';
}
add_filter( 'woocommerce_return_to_shop_redirect', 'cds_wc_empty_cart_redirect_url', 20 );
@ApoGouv
ApoGouv / 00_wp-optimizations-security-n-cleanup.md
Last active September 7, 2024 11:35
WP - Optimizations, Security hardening and Cleanup.

** WP - Optimizations, Security hardening and Cleanup **

Here you can find a a list of WP optimization and cleanup functions and methodology.

1.  .htaccess
  ** Security **
- Disable the server signature
- Disable directory browsing
- Force https to your site.

Linux commands related to file permissions

To change all the directories to 755 (drwxr-xr-x):

find /opt/lampp/htdocs -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r--r--):

@ApoGouv
ApoGouv / php_pretty_print_data_for_debug.md
Last active March 20, 2024 10:09
PHP - Pretty print data for debugging.

Print readable (copy/paste ready) code

echo '<pre>' . var_export($data, true) . '</pre>';

OR

with syntax highlighting

@ApoGouv
ApoGouv / wp-print-vars-in-footer-admin-only.php
Last active October 18, 2018 07:26
WordPress scripts for functions.php file
@ApoGouv
ApoGouv / gitcom.md
Created September 30, 2018 07:13 — forked from jednano/gitcom.md
Common git commands in a day-to-day workflow

Git Cheat Sheet

Initial Setup

Create an empty git repo or reinitialize an existing one

$ git init