Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
andrewlimaza / retroactively-enroll-members-learndash-pmpro.php
Last active November 27, 2023 12:40
Retroactively enroll members into LearnDash Courses that are restricted with PMPro.
<?php
/**
* Retroactively enroll members into LearnDash courses via a cron job (or whenever you want to use this callback).
*
* Does batches of 50 members at a time that aren't enrolled and should be.
* Use a tool like WP Crontrol or manually set up a cron job for this callback to automatically run every couple of minutes or hours.
* Add this code to your custom plugin by visiting this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_courses_silent_enroll(){
global $wpdb;
@robmiller
robmiller / play-wordle.rb
Last active February 15, 2022 19:40
A command-line, offline version of Wordle. A new word every time you run it.
#!/usr/bin/env ruby
#
# Play a command-line version of Wordle
#
# Original game by Josh Wardle: https://www.powerlanguage.co.uk/wordle/
#
# Installation and usage:
#
# 1. Save this file somewhere as play-wordle.rb
# 2. Run `ruby play-wordle.rb`
@128keaton
128keaton / install_ffmpeg.sh
Last active November 17, 2021 06:48 — forked from Piasy/install_ffmpeg.sh
Install ffmpeg on macOS via homebrew with all the options (minus chromaprint and decklink), updated for latest Homebrew version
#!/bin/bash
brew uninstall --force --ignore-dependencies ffmpeg
brew install chromaprint amiaopensource/amiaos/decklinksdk
brew tap homebrew-ffmpeg/ffmpeg
brew install ffmpeg
brew install --cask xquartz
brew upgrade homebrew-ffmpeg/ffmpeg/ffmpeg $(brew options homebrew-ffmpeg/ffmpeg/ffmpeg | grep -vE '\s' | grep -- '--with-' | grep -vi 'chromaprint\|decklink' | tr '\n' ' ')
@mlschmitt
mlschmitt / Merlin_Wisdom_Widget_Scriptable.js
Last active May 19, 2023 16:58
Random wisdom from Merlin Mann in a handy widget - https://github.com/merlinmann/wisdom
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: blue; icon-glyph: brain;
let items = await loadItems()
if (config.runsInWidget) {
let widget = await createWidget(items)
Script.setWidget(widget)
} else if (config.runsWithSiri) {
let firstItems = items.slice(0, 5)
let table = createTable(firstItems)
@merlinmann
merlinmann / wisdom.md
Last active April 17, 2024 21:52
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@AlexanderWillner
AlexanderWillner / things.sh
Last active September 15, 2023 07:29 — forked from avdgaag/things.sh
Command-line read-only interface to your local Things database of to do items.
Moved to https://github.com/alexanderwillner/things.sh/
@sjl
sjl / qud-item-values
Last active May 5, 2022 07:45
Item values in Caves of Qud, sorted by value/weight ratio
PRICE/WEIGHT | ITEM-KEY | DISPLAY-NAME | PRICE | WEIGHT
10000.0 | HANDENUKE | &mHand-E-Nuke | 10000.0 | 1.0
3000.0 | TIMECUBE | &ctimecube | 3000.0 | 1.0
2265.0 | MENTAL-AGGREGATOR | mental aggregator | 2265.0 | 1.0
1135.0 | SHORT-SWORD8 | &rmetametal &Kshort sword | 1135.0 | 1.0
750.0 | GEOMAGNETIC-DISC | geomagnetic disc | 750.0 | 1.0
635.0 | DAGGER8 | &rmetametal dagger | 635.0 | 1.0
630.0 | SHORT-SW
@jkishner
jkishner / instagramImage.py
Last active August 3, 2016 04:59
instagramImage.py
import requests
import json
import sys
import urllib
import webbrowser
url = sys.argv[1]
data = requests.request('GET','http://api.instagram.com/publicapi/oembed/?url=' + url)
if data.status_code == 200:
embed = json.loads(data.text)
img = embed['thumbnail_url']
javascript:
// Take the current page URL and put it in a variable called url
var url = document.URL;
// Create a new variable called tweetbotProfile and replace the mobile twitter url with the Tweetbot x-callback-url scheme
var tweetbotProfile = url.replace("https://mobile.twitter.com/","tweetbot:///user_profile/");
// Go to the new URL in tweetbotProfile
window.location = tweetbotProfile;
@hiilppp
hiilppp / list.py
Created December 10, 2013 01:11
Python script to manipulate text in Pythonista in the following manner and send the result (back) to Drafts: Sort lines, remove blank and duplicate lines, and prepend a hyphen to lines which don't start with one.
# To call script from Drafts, use the follwing URL as URL Action:
# <pythonista://list.py?action=run&argv=[[draft]]>
import os
import re
import sys
import urllib
import webbrowser
a = re.sub(r"(?m)^[*-] ", "", sys.argv[1])