View convert_excel_to_date.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert date and time from Excel into a PHP DateTime object | |
* | |
* Based on similar function from PHPExcel library. | |
* | |
* @see https://stackoverflow.com/a/11172688/401980 | |
* @see http://www.cpearson.com/excel/datetime.htm | |
*/ |
View update_meta.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$args = [ | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image', | |
'numberposts' => -1, | |
'post_status' => null, | |
'post_parent' => null, | |
]; | |
$attachments = get_posts($args); |
View functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// move admin bar to bottom of screen when viewing site | |
function benjibee_modify_adminbar() | |
{ | |
?> | |
<style> | |
div#wpadminbar { | |
top: auto; | |
bottom: 0; |
View maintenance.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// place in wp-content directory to | |
// automatically override default page | |
http_response_code(503); | |
wp_load_translations_early(); | |
?><!DOCTYPE html> | |
<html> |
View scrape.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* NOT YET IMPLEMENTED FUNCTIONALITY!! EEEEEEP!!!! | |
* | |
* Taken from ticket: #16784 | |
* https://core.trac.wordpress.org/attachment/ticket/16784/16784.diff | |
* | |
* NOT YET IMPLEMENTED FUNCTIONALITY!! EEEEEEP!!!! | |
* | |
* |
View index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. | |
* | |
*/ |
View deploy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('REPO_PATH', '/repositories/'); | |
define('STAGING_PATH', '/htdocs/dev/'); | |
define('PRODUCTION_PATH', '/htdocs/'); | |
$git = 'git'; | |
$update = false; |
View flac_to_mp3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View url_matcher.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$new_entry['url'] = FALSE; | |
$new_entry['description'] = 'Hello there! example.com'; | |
$pattern_url = "`(" | |
. "(https?://)?" | |
. "([a-z\d-]+\.)+" | |
. "(MUSEUM|TRAVEL|AERO|ARPA|ASIA|EDU|GOV|MIL|MOBI|COOP|INFO|NAME|BIZ|CAT|COM|INT|JOBS|NET|ORG|PRO|TEL|A[CDEFGILMNOQRSTUWXZ]|B[ABDEFGHIJLMNORSTVWYZ]|C[ACDFGHIKLMNORUVXYZ]|D[EJKMOZ]|E[CEGHRSTU]|F[IJKMOR]|G[ABDEFGHILMNPQRSTUWY]|H[KMNRTU]|I[DELMNOQRST]|J[EMOP]|K[EGHIMNPRWYZ]|L[ABCIKRSTUVY]|M[ACDEFGHKLMNOPQRSTUVWXYZ]|N[ACEFGILOPRUZ]|OM|P[AEFGHKLMNRSTWY]|QA|R[EOSUW]|S[ABCDEGHIJKLMNORTUVYZ]|T[CDFGHJKLMNOPRTVWZ]|U[AGKMSYZ]|V[ACEGINU]|W[FS]|Y[ETU]|Z[AMW])+" | |
. "(:\d+)?" | |
. "((/([a-z0-9\._/~%\-\+&\#\?!=\(\)@]+)?)*)" |
NewerOlder