Skip to content

Instantly share code, notes, and snippets.

benjibee / update_meta.php
Created Dec 16, 2020
Update WordPress attachment meta
View update_meta.php
$args = [
'post_type' => 'attachment',
'post_mime_type' => 'image',
'numberposts' => -1,
'post_status' => null,
'post_parent' => null,
$attachments = get_posts($args);
benjibee / functions.php
Last active Apr 21, 2020
Wordpress: Move adminbar to bottom, expand on hover
View functions.php
// move admin bar to bottom of screen when viewing site
function benjibee_modify_adminbar()
div#wpadminbar {
top: auto;
bottom: 0;
benjibee / maintenance.php
Last active Nov 25, 2019
Default Maintenance Page for Wordpress
View maintenance.php
// place in wp-content directory to
// automatically override default page
?><!DOCTYPE html>
benjibee / scrape.js
Created Feb 10, 2018
A little script to import starred places saved as geoJSON data from Google Maps. Could be better. Works.
View scrape.js
// This script is meant to import Google Maps starred places into
// another Google account.
// Given a geoJSON file of Google Maps starred places (places.json)
// exported by Google takeout (account backup) this script should
// open each place URL and manually click save.
// Upon first run, it's best to stop it and manually login to your
// Google account otherwise you'll run into a non-verified device
// issue. Run again and it should continue through with problems.
View functions.php
* Taken from ticket: #16784
benjibee / index.php
Created Feb 2, 2015
BitBucket Webhook
View index.php
* ButBucket Webhook `git pull` automation v0.1
* @author Benji Bilheimer
* If a directory matching the repository name is found
* in BASE_PATH, CD into that directory and run a git pull.
benjibee / deploy.php
Created Aug 6, 2014
Bitbucket Deploy Hook
View deploy.php
define('REPO_PATH', '/repositories/');
define('STAGING_PATH', '/htdocs/dev/');
define('PRODUCTION_PATH', '/htdocs/');
$git = 'git';
$update = false;
benjibee / flac_to_mp3
Created Jun 23, 2014
Convert FLAC to Mp3 (AAC)
View flac_to_mp3
brew install ffmpeg
## cd into the folder containing the FLAC files
for f in *.flac; do ffmpeg -i "$f" -aq 1 "${f%flac}mp3"; done
benjibee / url_matcher.php
Last active Apr 8, 2018
Extracts any one URL in the given string and assigns it to a variable.
View url_matcher.php
$new_entry['url'] = FALSE;
$new_entry['description'] = 'Hello there!';
$pattern_url = "`("
. "(https?://)?"
. "([a-z\d-]+\.)+"
. "(:\d+)?"
. "((/([a-z0-9\._/~%\-\+&\#\?!=\(\)@]+)?)*)"
benjibee / .gitignore
Last active Apr 8, 2018
Ignoring and untracking Wordpress contents
View .gitignore
# contents of wp-content (but not the folder itself)
# both sitemap.xml and sitemap.gzip
# local config for local dev!
# override above exclusion to include the blog theme folder and files