Skip to content

Instantly share code, notes, and snippets.

@mdrovdahl
mdrovdahl / gist:211d7af5267f81c9202e6f39c1d6ac59
Created March 28, 2024 22:29
Filter the product stock availability message in WooCommerce to use "registration" centric language
// Modify the stock availability message to use "registration" centric language
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
// Change In Stock Text
if ( $_product->is_in_stock() ) {
$availability['availability'] = __('Registration Is Open', 'woocommerce');
}
// Change Out of Stock Text
if ( ! $_product->is_in_stock() ) {
@mdrovdahl
mdrovdahl / _README.md
Last active April 29, 2022 22:58 — forked from jifalops/_README.md
Headless Crostini quick setup script for WordPress development

Headless Crostini quick setup script for WordPress development

WARNING

  • The script appends to the PATH environment variable each time it runs (at the end).

To get the script, use the Terminal app:

user@penguin:~$ mkdir bin && cd $_
user@penguin:~/bin$ curl -O https://gist.githubusercontent.com/mdrovdahl/3e941c129c70d3d0bd1fbc088de1f31b/raw/setup-dev-machine.sh
@mdrovdahl
mdrovdahl / sitemap_checker.py
Last active April 12, 2017 23:06
Find missing dates in example.com/sitemap.xml
#!/usr/bin/env python3
import requests, argparse, untangle
from urlparse import urlparse, parse_qs
from datetime import datetime, date, timedelta
domain = "https://example.com/"
path = "/sitemap.xml"
@mdrovdahl
mdrovdahl / gist:5b2edc510439776ed02a2cb8221dbee5
Created November 14, 2016 16:29
Deconstructing the NeviWeb API
Warning, raw notes below...
Functions:
DEFINES
input("email", "text", title: "E-mail", description: "Your neviweb® account login e-mail")
input("password", "password", title: "Password", description: "Your neviweb® account login password")
input("gatewayname", "text", title: "Network Name:", description: "Name of your neviweb® network")
input("devicename", "text", title: "Device Name:", description: "Name of your neviweb® thermostat")
@mdrovdahl
mdrovdahl / neviweb.py
Last active December 20, 2016 05:47
Rough access to SinopeTech Smart Thermostat Data
#!/usr/bin/env python3
# This is a rough prototype for accessing device information from Sinope devices via their neviweb.com service and recording it to a Google Sheet
# TODO
# 1. move neviweb u/p into google auth json file in home directory
# 2. add outside temperature, avaliable from neviweb, but ideally from Bloomsky Weather Station
# 3. run as recurring cron job
from __future__ import print_function
@mdrovdahl
mdrovdahl / neviweb.py
Created April 11, 2016 05:29
Rough access to SinopeTech Smart Thermostat Data
#!/usr/bin/env python3
import requests
email = "[email protected]" # Your neviweb account login e-mail
password = "password" # Your neviweb account login password
gatewayname = 'Home' # Name of your neviweb network
dataServer = "https://neviweb.com/"
# TODO make this the login() function
"""
Copyright (c) 2009, Aaron Bycoffe
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright