Skip to content

Instantly share code, notes, and snippets.

View matthewmcvickar's full-sized avatar
🍃

Matthew McVickar matthewmcvickar

🍃
View GitHub Profile
@matthewmcvickar
matthewmcvickar / README.md
Last active February 15, 2023 18:53
Using Google Analytics to Get the Most Popular WordPress Pages

This is a set of PHP scripts to fetch the most-viewed pages from a Google Analytics property.

You will need to set up API access for this project in the Google Cloud Platform Console and create an authorization JSON file.

@matthewmcvickar
matthewmcvickar / .browserslistrc
Last active November 25, 2019 21:20
Config files
# Browsers that we support.
# https://github.com/browserslist/browserslist
last 1 version and > .1% and not dead
not OperaMini all
@matthewmcvickar
matthewmcvickar / show-all-coauthors-as-csv.php
Last active February 14, 2019 22:31
Output a CSV-formatted list of all Co-Authors Plus users
<?php
// N.B.: This probably only works on popula.com; I don't know what the Co-Authors Plus metadata situation is by default. ¯\_(ツ)_/¯
// Print a CSV-formatted list of all co-authors and their email addresses.
function output_all_coauthors_as_csv() {
$coauthors = get_posts(array(
'post_type' => 'guest-author',
'posts_per_page' => -1
));

Reason

The PDFs Blue Apron provides are two-pages and full of color and detail that wastes ink. This just prints a plain version of the recipe. Blue Apron's print stylesheet doesn't get rid of everything, though, so I made this.

The Code

The bookmarklet just runs this bit of jQuery:

Keybase proof

I hereby claim:

  • I am matthewmcvickar on github.
  • I am matthewmcvickar (https://keybase.io/matthewmcvickar) on keybase.
  • I have a public key ASBqES5tVV6C12duSrynE8MQfSa0keOEjEKTr7Bv4UGKQwo

To claim this, I am signing this object:

@matthewmcvickar
matthewmcvickar / Bot Ideas.md
Last active June 6, 2016 19:45
Bot Ideas and Resources
@matthewmcvickar
matthewmcvickar / current_moon_phase.md
Last active September 6, 2017 18:51
A failed attempt at converting the moon-phase finding Ruby script to a Bash shell script.

Trying to Convert the Ruby Moon Phase-finder to Bash

2013-04-02, 10:28pm

Below is my feeble attempt to convert the moon-phase Ruby script into Bash.

Unfortunately, this doesn't work for two reasons:

  1. I don't know shell scripting very well.
  2. Bash arithmetic can't handle anything other than integers.
@matthewmcvickar
matthewmcvickar / .bash_prompt
Last active December 20, 2022 22:59
Get the current phase of the moon and use it to print an emoji moon phase image. OS X only, requires some shell knowledge. (Emoji moon phases will not show up here, but they will when you copy and paste or download the file.)
# Get the current phase of the moon for use as prompt
# Adapted from: http://wan.pengganas.net/entry/calculating-phase-of-moon-in-ruby
function moonphase() {
/usr/bin/env ruby <<-EORUBY
# Convert a date to Julian.
def julian(year, month, day)
a = (14-month)/12
y = year+4800-a
m = (12*a)-3+month
@matthewmcvickar
matthewmcvickar / get_frontmost_finder_path.applescript
Last active December 13, 2015 19:39
Get the path of the frontmost Finder window. If it is within the user’s folder, replace the `/Users/USERNAME/` with `~/` so that the path can be shared with others.
tell application "Finder"
tell application "System Events" to set current_user to name of current user
set AppleScript's text item delimiters to "/Users/" & current_user
try
return "~" & text item 2 of POSIX path of (target of front Finder window as text)
on error
return POSIX path of (target of front Finder window as text)
end try
end tell
@matthewmcvickar
matthewmcvickar / set_mail_sender.applescript
Last active September 28, 2015 00:38
Set Mail.app Message Sender
(*
Set Mail.app Sender
By Matthew McVickar
Description:
Mail.app's AppleScript library does not allow access to the properties
of the outgoing message object. The only way to change those properties
is by GUI scripting. This particular script changes the sender of the
message. If you have, for example, personal and work email addresses