Skip to content

Instantly share code, notes, and snippets.

View iecoding's full-sized avatar
🎯
Focusing

Israel Estrada iecoding

🎯
Focusing
View GitHub Profile
@iecoding
iecoding / add-wpcli.sh
Created February 16, 2024 21:29 — forked from ladislavsulc/add-wpcli.sh
Add WP CLI to Laragon
cd C:\laragon\usr\bin && curl -L -O https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && echo @ECHO OFF > wp.bat && echo php "%~dp0wp-cli.phar" %* >> wp.bat
@madaarya
madaarya / install_elasticsearch_ubuntu_wsl2.sh
Created November 23, 2021 04:08
Step by step Install elasticsearch on wsl2 + ubuntu
// elasticsearch version 7
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.5.2-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.5.2-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-oss-7.5.2-linux-x86_64.tar.gz.sha512
tar -xzf elasticsearch-oss-7.5.2-linux-x86_64.tar.gz
cd elasticsearch-oss-7.5.2/
echo 'export ES_HOME="$HOME/elasticsearch-7.5.2/"' >> ~/.bashrc
echo 'export PATH="$ES_HOME/bin:$PATH"' >> ~/.bashrc
exec $SHELL
@ladislavsulc
ladislavsulc / add-wpcli.sh
Created October 27, 2020 17:29
Add WP CLI to Laragon
cd C:\laragon\usr\bin && curl -L -O https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && echo @ECHO OFF > wp.bat && echo php "%~dp0wp-cli.phar" %* >> wp.bat
@ko31
ko31 / how-to-send-an-email-manually-using-woocommerce-email-templates.php
Last active August 25, 2023 20:32
How to send an email manually using WooCommerce email templates.
<?php
// Load the WooCommerce email templates.
$wc_emails = WC()->mailer()->get_emails();
/**
* You can specify which template mail is to be sent from the following array elements.
* 'WC_Email_New_Order'
* 'WC_Email_Cancelled_Order'
* 'WC_Email_Failed_Order'
* 'WC_Email_Customer_On_Hold_Order'
@xirixiz
xirixiz / Set up GitHub push with SSH keys.md
Last active July 22, 2024 10:35 — forked from developius/README.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "your_email@example.com"
@hamg26
hamg26 / rng-coinFlip.js
Last active May 20, 2019 04:44
You are provided this flip function: function flip() { return Math.random() >= 0.5; }. You must implement a randomNumber(n) function that generates a random number greater than or equal to 0, and less than input n. n must be greater than 0. n must be less than 1,000,000. Your only source of randomness must be the provided flip() function. You ca…
function flip() {
return Math.random() >= 0.5;
}
function randomNumber(n) {
if(n === undefined) throw new Error("n is required");
if(n <= 0) throw new Error("n must be greater than 0");
if(n > 1000000) throw new Error("n must be lower than 1,000,000");
// No need to further calculations
@aslamdoctor
aslamdoctor / woocommerce-mini-cart.php
Last active April 21, 2022 01:42
Woocommerce : Update Cart Count & Mini Cart
<!-- Add this to Header -->
<div class="header-mini-cart"><?php woocommerce_mini_cart();?></div>
<?php
// Update Cart Count & Mini Cart
add_filter( 'woocommerce_add_to_cart_fragments', 'iconic_cart_count_fragments', 10, 1 );
function iconic_cart_count_fragments( $fragments ) {
if(!empty(WC()->cart->get_cart_contents_count())){
@nonbeing
nonbeing / git-deployment.md
Last active July 13, 2024 23:11 — forked from noelboss/git-deployment.md
Simple deployment using git's post-receive hook

Also see: https://gist.github.com/lemiorhan/8912188

Simple automated deployment using git hooks

Here are the simple steps needed to push your local git repository directly to a remote (e.g. prod) server over ssh. This is based on Digital Ocean's Tutorial.

Overview

You are developing in a working-directory on your local machine, let's say on the master branch. Usually people push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use GitHub's webhooks to send a POST request to a webserver to take appropriate actions such as cloning/checking out a branch on the remote (prod) server.

#Error: Database creation error: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.

##solution

root@server:~# su postgres
postgres@server:~ $ psql -U postgres
psql (9.0.3)
Type "help" for help.
@cleverinx
cleverinx / custom_walker.php
Created May 8, 2016 04:15
Custom Wordpress Sub-Menu Walker
class custom_sub_walker extends Walker_Nav_Menu {
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n";
}
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';