Skip to content

Instantly share code, notes, and snippets.

View bahiirwa's full-sized avatar
🏠
Working from home

Laurence Bahiirwa bahiirwa

🏠
Working from home
View GitHub Profile
@bahiirwa
bahiirwa / README.md
Created April 12, 2017 16:47 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@bahiirwa
bahiirwa / Default Taxonomy Term for CPT
Created August 5, 2017 05:31 — forked from mayeenulislam/Default Taxonomy Term for CPT
Make Default taxonomy term for Custom Post Type - WordPress
/**
* Author: Michael Fields
* Source: http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/
* Thanks a lot for the nice tweak
*/
/**
* Define default terms for custom taxonomies in WordPress 3.0.1
*
@bahiirwa
bahiirwa / local gulp workflow
Created August 25, 2017 01:58
My gulp local workflow
npm init to create package.js
create gulpfile.js
Install Local dependecies
npm install --save-dev gulp gulp-autoprefixer gulp-sass gulp-uglify gulp-concat
Write gulp tasks like
const gulp = require('gulp');
const sass = require('gulp-sass');
@bahiirwa
bahiirwa / page-metabox.php
Created August 25, 2017 11:02 — forked from dingo-d/page-metabox.php
A page metabox with a color picker option
<?php
add_action( 'admin_enqueue_scripts', 'mytheme_backend_scripts');
if ( ! function_exists( 'mytheme_backend_scripts' ) ){
function mytheme_backend_scripts($hook) {
wp_enqueue_media();
wp_enqueue_style( 'wp-color-picker');
wp_enqueue_script( 'wp-color-picker');
}
@bahiirwa
bahiirwa / Woocommerce Archive loop text edits
Created September 5, 2017 02:56
Woocommerce Archive loop text edits
/*Proceed to Checkout*/
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
add_action('woocommerce_proceed_to_checkout', 'sm_woo_custom_checkout_button_text',20);
function sm_woo_custom_checkout_button_text() {
$checkout_url = WC()->cart->get_checkout_url();
?>
<a href="<?php echo $checkout_url; ?>" class="checkout-button button alt wc-forward"><?php _e( 'Check On Out', 'woocommerce' ); ?></a>
<?php
@bahiirwa
bahiirwa / YouTube Playlists to follow
Last active November 15, 2017 02:50
YouTube Playlists to follow
Python, Perl, bash and languages
https://www.youtube.com/watch?v=zRwy8gtgJ1A&list=PLillGF-RfqbbbPz6GSEM9hLQObuQjNoj_
https://www.youtube.com/playlist?list=PL_RGaFnxSHWpqRBcStwV0NwMA3nXMh5GC
https://www.youtube.com/watch?v=cQepf9fY6cE&list=PLS1QulWo1RIYmaxcEqw5JhK3b-6rgdWO_
https://www.youtube.com/watch?v=hwrnmQumtPw&list=PLXAjsl8HLYQGq31B5FtfUacT_xbY-SPMB
https://www.youtube.com/playlist?list=PL0-84-yl1fUnRuXGFe_F7qSH1LEnn9LkW
https://www.youtube.com/watch?v=Auo0Ab6oOlo&list=PLillGF-RfqbaQrnidRDPJTx9Z8zazeVEn
https://www.youtube.com/watch?v=2LeqilIw-28&list=PLillGF-RfqbZ7s3t6ZInY3NjEOOX7hsBv
https://www.youtube.com/watch?v=vEROU2XtPR8&list=PLillGF-RfqbbnEGy3ROiLWk7JMCuSyQtX
@bahiirwa
bahiirwa / Woocommerce change add to cart text
Created September 9, 2017 12:30
Woocommerce change add to cart text
<?php
add_filter('woocommerce_product_add_to_cart_text', 'wh_archive_custom_cart_button_text'); // 2.1 +
function wh_archive_custom_cart_button_text()
{
return __('Place your order', 'nxgen_ug');
}
@bahiirwa
bahiirwa / var_dump
Last active September 13, 2017 05:53
var_dump
echo '<pre>';
var_dump($term);
echo '</pre>';
@bahiirwa
bahiirwa / Wordpress Query Users based on meta_value
Created September 9, 2017 14:28
Wordpress Query Users based on meta_value
$args = array(
'meta_query' => array(
'relation' => 'AND',
array(
array(
'key' => 'mps_finaldate',
'value' => '',
'compare' => '!='
),
array(
@bahiirwa
bahiirwa / custom Metaboxes OOP
Created October 2, 2017 11:21
Custom Metaboxes OOP
//class custom_metabox
// {
//
// private $cm_name_id;
// private $cm_name;
// private $cpt_name;
//
// function __construct( $cm_name_id, $cm_name, $cpt_name ) {
// $this->cm_name = $cm_name_id;
// $this->cm_name = $cm_name;