Skip to content

Instantly share code, notes, and snippets.

View craigpearson's full-sized avatar

Craig Pearson craigpearson

View GitHub Profile
@craigpearson
craigpearson / Output order data
Created May 23, 2023 10:36
Output order data
#!/bin/bash
# List all the site URLs
sites=$(wp site list --field=url)
# Loop over each site
for site in $sites
do
# Create a safe filename from the URL
filename=$(echo "$site" | sed 's/https\?:\/\///' | sed 's/\//_/g')
@craigpearson
craigpearson / vs-code-keyboard-shortcuts.MD
Last active September 24, 2019 00:01
VS Code Keyboard Shortcuts

VS Code Keyboard Shortcuts

Shortcut Action
⌘ cmd + ⇧ shift + [ Focus on previous file
⌘ cmd + ⇧ shift + ] Focus on next file
⌘ cmd + \ Split current file
⌘ cmd + ⌥ alt + 0 Toggle Horizontal / Vertical group

Focus and Navigation

@craigpearson
craigpearson / ansible-vagrant-arguments-tags.MD
Created February 18, 2019 22:59
Passing arguments to vagrant provision with Ansible such as --tags

Option 1

Modify your Vagrantfile to pass ANSIBLE_ARGS

config.vm.provision "ansible" do |ansible|
   ansible.playbook = "dev.yml"
   # Etc
   ansible.raw_arguments = Shellwords.shellsplit(ENV['ANSIBLE_ARGS']) if ENV['ANSIBLE_ARGS']
end
@craigpearson
craigpearson / git-cheatsheet.MD
Created February 6, 2019 00:41
Git Cheatsheet

Git Cheatsheet

Cloning a repo

# Clone repo to current folder
git clone https://github.com/USERNAME/REPOSITORY.git

# Clone repo to specified folder
git clone https://github.com/USERNAME/REPOSITORY.git specified-folder
@craigpearson
craigpearson / Markdown Code Blocks
Created February 5, 2019 23:50
Markdown Code Blocks
actionscript3
apache
applescript
asp
brainfuck
c
cfm
clojure
cmake
coffee-script, coffeescript, coffee
<?php
namespace App;
add_action('after_setup_theme', function() {
$sage = sage('blade')->compiler();
/**
* Create @asset() Blade directive
*/
@craigpearson
craigpearson / acf-filters.php
Last active September 20, 2017 23:43
Update ACF JSON load / save path in Sage 9 starter theme. Drop into app/filters.php or include from functions.php
/**
* Update save location for ACF JSON
*/
add_filter('acf/settings/save_json', function ( $path ) {
// Add path - Note uses get_template_directory to override any child theme JSON
$path = get_template_directory() . '/assets/acf-json';
// Create the directory in themes that don't exist
if (!is_dir($path)) {
@craigpearson
craigpearson / gravityforms.scss
Last active September 20, 2017 23:39 — forked from JodiWarren/gravityforms.scss
Style Gravity Forms with Bootstrap 3 (SASS) - `From`: http://roots.io/style-gravity-forms-with-bootstrap/
.gform_wrapper ul {
@extend .list-unstyled;
}
.gform_wrapper li {
@extend .form-group;
}
.gform_wrapper form {
margin-bottom: 0;
}
.gform_wrapper .gfield_required {
@craigpearson
craigpearson / 0_reuse_code.js
Created September 15, 2016 23:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
.gform_wrapper ul {
@extend .list-unstyled;
}
.gform_wrapper li {
@extend .form-group;
}
.gform_wrapper form {
margin-bottom: 0;