Skip to content

Instantly share code, notes, and snippets.

View astroud's full-sized avatar

Aaron Stroud astroud

View GitHub Profile
@babette-landmesser
babette-landmesser / nodejs-crawler.js
Created May 31, 2020 09:52
A simple nodejs crawler to collect all internal links on a given domain
const cheerio = require('cheerio');
const request = require('request');
const fs = require('fs');
const crawledPages = [];
const crawledPagesData = [];
let foundPages = [];
let index = 0;
const domain = process.argv[2];
@woogists
woogists / wc-show-cart-contents-total.php
Last active October 26, 2021 20:29
[Theming Snippets] Show cart contents / total
// Use in conjunction with https://gist.github.com/woogists/c0a86397015b88f4ca722782a724ff6c
<a class="cart-customlocation" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@lukecav
lukecav / Query
Last active July 11, 2024 16:45
MySQL script to get all WooCommerce orders including metadata
select
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
max( CASE WHEN pm.meta_key = '_billing_state' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_state,
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@manicExpressive
manicExpressive / gist:2869162
Created June 4, 2012 15:51
New site setup instructions
1. Purchase domain (hover.com)
2. Heroku app for website
* copy existing site
* Make git repo run
$ git init .
$ git add .
$ git commit -a -m "intial commit"
* $ heroku apps:create DOMAIN (https://devcenter.heroku.com/articles/creating-apps)
* $ git push heroku master
* $ heroku domains:add www.DOMAIN.com
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/