Skip to content

Instantly share code, notes, and snippets.

View sebacruz's full-sized avatar
🤖

Sebastián Cruz sebacruz

🤖
View GitHub Profile
@sebacruz
sebacruz / remove-hidden-products-query.php
Created October 13, 2020 09:54 — forked from ChrisFlannagan/remove-hidden-products-query.php
Woo doesn’t filter out products with hidden catalog visibility outside of main shop loop. This is important to remember when using the REST API for front end display or general search results. This code snippet will keep them from showing outside of the admin. Source: whoischris.com
<?php
/**
* https://whoischris.com/remove-catalog-visibility-hidden-products-in-woocommerce-from-search-wp-rest-api-results/
*/
add_action( 'pre_get_posts', 'hidden_search_query_fix' );
public function hidden_search_query_fix( $query = false ) {
if ( ! is_admin() && isset( $query->query['post_type'] ) && $query->query['post_type'] === 'product' ) {
$tax_query = $query->get( 'tax_query' );
$tax_query[] = [
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
@sebacruz
sebacruz / how-to-add-image-to-gist.md
Created March 29, 2020 12:02 — forked from mroderick/how-to-add-image-to-gist.md
How to add an image to a gist

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh
@sebacruz
sebacruz / Storing-Images-On-Github.md
Created March 29, 2020 12:00 — forked from joncardasis/Storing-Images-On-Github.md
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets

@sebacruz
sebacruz / laravel-email-test.md
Last active March 17, 2020 21:33
Send raw emails from `laravel tinker`
@sebacruz
sebacruz / README.md
Last active September 26, 2019 03:22 — forked from Rambou/gist:c6769caee19b0b9915d8342b86c3ef72
Installing Nvidia propreatary drivers in Linux with UEFI enabled

If, like me, your are booting with UEFI (because having a triple boot ubuntu-windows-mac or because UEFI is the most modern type of bootloader and successor of EFI :p), you have to sign the proprietary modules each time they are recompiled (or upgrade kernel version) so that they are allowed to be loaded in the kernel.

  1. Step one, create a self-signed certificate to sign nvidia driver:
sudo openssl req -new -x509 -newkey rsa:2048 -keyout UEFI.key -outform DER -out UEFI.der -nodes -days 36500 -subj "/CN=rambou_nvidia/"
  1. step two load and store certificate in a supplementary key database MOC
@sebacruz
sebacruz / README.md
Last active September 19, 2019 04:41
"How to secure your dotfiles" by @Awan
@sebacruz
sebacruz / README.md
Created April 25, 2019 01:21
Set timezone on debian-based systems
@sebacruz
sebacruz / README.md
Created February 23, 2019 01:08
Merge audio and video with `ffmpeg`

Merge audio and video with ffmpeg

Merging video and audio, with audio re-encoding

$ ffmpeg -i video.mp4 -i audio.wav \
  -c:v copy -c:a aac -strict experimental output.mp4

Copying the audio without re-encoding

@sebacruz
sebacruz / .bash_profile
Last active August 15, 2020 01:39
Simple bash and vi configurations
export PS1="\n\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;242m\]\A\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;81m\]\w\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\]\n\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;78m\]\\$\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]";
export EDITOR='vim';
export LANG='en_US.UTF-8';
export LC_ALL='en_US.UTF-8';
export GREP_OPTIONS='--color=auto';