Skip to content

Instantly share code, notes, and snippets.

View cfaria's full-sized avatar
🍊
Citius, altius, fortius... Communiter

Carlos Faria cfaria

🍊
Citius, altius, fortius... Communiter
View GitHub Profile
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active August 10, 2026 16:02
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Last update: Nov 2025.

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl ecparam -genkey -name secp384r1 | openssl ec -aes256 -out rootCA.key
@tripflex
tripflex / functions.php
Last active March 19, 2025 11:59
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@nikoskip
nikoskip / gfonts.php
Last active February 2, 2025 08:26
Demo: http://nikoskip.me/gfonts.php | You only have to use the CSS import URL that Google gives you, for instance: http://fonts.googleapis.com/css?family=Cabin:500,700,500italic,700italic
<?php
$fontTypes = array('woff2', 'woff', 'ttf', 'svg', 'eot');
$gFontURL = 'http://fonts.googleapis.com/css?family=';
$uaFonts = array(
'woff2' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
'woff' => 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/4.0; GTB7.4; InfoPath.3; SV1; .NET CLR 3.1.76908; WOW64; en-US)',
'ttf' => 'Mozilla/5.0 (Linux; U; Android 2.2.1; en-ca; LG-P505R Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
'svg' => 'Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10',
@leewillis77
leewillis77 / functions.php
Created April 28, 2016 10:58
Schema.org video markup for Vimeo video embeds on WordPress
<?php
function crfw_embed_oembed_html($html, $url, $attr, $post_id) {
// Only do something if this is Vimeo embed.
if ( stripos( $url, 'https://vimeo.com' ) !== 0 ) {
return $html;
}
// Grab the data we need.
$title = preg_replace('/.*title="([^"]*)".*/', '$1', $html);
@claudiosanches
claudiosanches / custom-my-account-endpoint.php
Last active October 28, 2024 06:17
Example of custom My Account endpoint.
<?php
class My_Custom_My_Account_Endpoint {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-custom-endpoint';
{
"name": "sage",
"homepage": "https://roots.io/sage/",
"authors": [
"Ben Word <ben@benword.com>"
],
"license": "MIT",
"private": true,
"dependencies": {
"bootstrap-sass": "3.3.6",
@kayintveen
kayintveen / ResetDefaultValues.php
Created November 17, 2015 09:31
Magento scripts that resets all products "use default values" setting of the admin store view. This script was created for a site that had thousands of products with deselected "Use Default Values" checkboxes in differente store-views
<?php
// Author: @kayintveen
// Credits: Microdesign B.V
// Created November 2015
//=====================================
// Enable Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
@vanbo
vanbo / remove-bank-details-from-order-email.php
Last active June 3, 2023 18:11
Remove bank details from WC order email. Place in functions.php
// Add your own action for the bank instructions
add_action( 'woocommerce_email_before_order_table', 'prefix_email_instructions', 9, 3 );
function prefix_email_instructions( $order, $sent_to_admin, $plain_text = false ) {
// Get the gateway object
$gateways = WC_Payment_Gateways::instance();
$available_gateways = $gateways->get_available_payment_gateways();
$gateway = isset( $available_gateways['bacs'] ) ? $available_gateways['bacs'] : false;
// We won't do anything if the gateway is not available
if ( false == $gateway ) {
@squarism
squarism / iterm2.md
Last active September 6, 2026 04:31
An iTerm2 Cheatsheet

In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So + D does not mean hold shift. + Shift + D does of course.

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
@vladimirlukyanov
vladimirlukyanov / dont_group_products_at_cart_woocommerce.php
Created September 16, 2015 20:25
Don't group products at cart – Woocommerce
<?php
add_filter('woocommerce_add_cart_item_data', 'namespace_force_individual_cart_items', 10, 2);
function namespace_force_individual_cart_items($cart_item_data, $product_id) {
$unique_cart_item_key = md5(microtime() . rand());
$cart_item_data['unique_key'] = $unique_cart_item_key;
return $cart_item_data;
}