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[] = [
@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 / 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 / roles_invesitgation.md
Created June 13, 2016 14:04 — forked from facultymatt/roles_invesitgation.md
Roles and permissions system for Nodejs
@sebacruz
sebacruz / nginx.conf
Created June 1, 2016 04:02 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
#!/bin/bash
# remove __MACOSX foldr and .DS_Store files
# from *_original.zip file
# zip again and place under fixed/*
for x in $*
do
unzip $x
@sebacruz
sebacruz / Homebrew.md
Created September 17, 2013 14:38 — forked from erutan/Homebrew.md

Installing a custom MAMP environment on OS X via Homebrew

Prerequisites

Xcode

Go to http://developer.apple.com/downloads, log in with your Apple ID (free) and download the newest version of either Command Line Tools (OS X Lion) for Xcode or Command Line Tools (OS X Mountain Lion) for Xcode. Run the installer in the dmg and you'll have the LLVM compiler, make, and other build tools.

XQuartz

@sebacruz
sebacruz / rest.php
Created September 11, 2013 18:04 — forked from cambiata/rest.php
<?php
/**
* Quickly assemled rest controller based on Kohana 3's Kohana_Controller_REST
* https://github.com/kohana/core/blob/3.1%2Fmaster/classes/kohana/controller/rest.php
*
* Added functionality from FuelPHP's Controller_Rest
* https://github.com/fuel/fuel/blob/develop/fuel/core/classes/controller/rest.php
*
* All credits to Kohana and FuelPHP teams!
* Jonas Nyström - cambiata