Skip to content

Instantly share code, notes, and snippets.

View stirtingale's full-sized avatar

Stirtingale stirtingale

View GitHub Profile
@stirtingale
stirtingale / config.yml
Created November 16, 2018 15:50 — forked from brettchalupa/config.yml
Shopify Theme Kit config example for screencast (https://www.youtube.com/watch?v=1xWFsYmBoX0)
development:
store: example.myshopify.com
password: add-password-in-config
theme_id: "live"
bucket_size: 40
refill_rate: 2
ignore_files:
- "*.swp"
- "*~"
- "config/settings_data.json"
@stirtingale
stirtingale / web.config
Created November 8, 2018 15:43 — forked from addisonhall/web.config
WordPress on IIS web.config with headers and cache control. Be sure to update "http://mydomain.com" with your site domain.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="Vary"></remove>
<add name="Vary" value="Accept-Encoding"></add>
</customHeaders>
</httpProtocol>
<staticContent>
@stirtingale
stirtingale / template_output_wbz404.php
Created October 18, 2017 12:41
Simple CSV for 404 Redirected by Redirectioner plugin
<?php
/*
Template Name: wbz404 > CSV output
*/
?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<p>source URL, target URL</p>
<?php
global $wpdb;
$redirects = array();
@stirtingale
stirtingale / dump.sh
Created August 9, 2017 10:51
Simple bash script to dump db from hosting into a subfolder
#!/bin/bash
now="$(date +'%d')"
# command to backup scripts goes here
WPDBNAME=`cat public_html/wp-config.php | grep DB_NAME | cut -d \' -f 4`
WPDBUSER=`cat public_html/wp-config.php | grep DB_USER | cut -d \' -f 4`
WPDBPASS=`cat public_html/wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`
mysqldump -u $WPDBUSER -p$WPDBPASS $WPDBNAME | gzip> db_backups/"$now"_backup.sql.gz
@stirtingale
stirtingale / instagram_id_to_url.php
Last active November 18, 2019 08:13
Simple PHP function to convert an Instagram ID into a URL.
// based on ggwarpig stackoverflow anwser to
// "Where do I find the Instagram media ID of a image"
// @ https://stackoverflow.com/a/37246231
function instagram_id_to_url($instagram_id){
$url_prefix = "https://www.instagram.com/p/";
if(!empty(strpos($instagram_id, '_'))){
@stirtingale
stirtingale / includes-acf.php
Created June 1, 2017 14:22
Advanced Custom Fields Includes
<?php
/* ========================================================================================================================
ACF Options
======================================================================================================================== */
// if( function_exists('acf_add_options_page') ) {
@stirtingale
stirtingale / console.php
Created May 18, 2017 14:35
Output All Wordpress Custom Fields to Console
<?php if ( current_user_can('administrator') ): ?>
<script>
function custom_field(key, value) {
this.key = key;
this.value = value;
}
<?php $getPostCustom=get_post_custom(); // Get all the data ?>
var cf = {};
<?php foreach($getPostCustom as $name=>$value): ?>
// an object whose properties are objects
<?php
/**
* Plugin Name: WooCommerce Custom Product Type
* Plugin URI: http://jeroensormani.com
* Description: A simple demo plugin on how to add a custom product type.
*/
/**
* Register the custom product type after init
*/
@stirtingale
stirtingale / gitmigrate.sh
Last active October 15, 2020 12:14
A Simple Migrate "Bitbucket" to "Github" Bash Script
#!/bin/bash
####################
## VARS ##
####################
# set this as your github username
username=stirtingale
password=qwerty
# automatically get existing git name
function get_git_name() {
git config --local remote.origin.url|sed -n 's#.*/\([^.]*\)\.git#\1#p'