Skip to content

Instantly share code, notes, and snippets.

View mrhead's full-sized avatar
👋
nil

Patrik Bóna mrhead

👋
nil
View GitHub Profile
# https://3.basecamp.com/3293071/buckets/5610905/card_tables/cards/10222876839
ActiveJob::Base.logger = Logger.new(nil)
subdomains = %w(
casinoguide
casinoreviewhub
cashwin-casino
parisvip-casino
roobet-casino
name basecamp-blank-lines
description Workaround for basecamp-cli losing blank lines between paragraphs (basecamp/basecamp-cli#636). Load this ALONGSIDE the basecamp skill whenever posting or updating multi-paragraph content via the Basecamp CLI — comments, messages, chat posts, check-in answers, or notes. Instructs posting raw HTML with <p><br></p> separators instead of Markdown. Temporary until the fix in basecamp/basecamp-cli#637 ships in a release newer than 0.9.1.
# Convert iPhone .mov videos to .mp4 videos which can be embedded in Basecamp.
IFS="
"
for video in *.mov; do
ffmpeg -i $video -c:v libx264 -crf 23 -c:a aac -strict -2 `echo $video | sed "s/mov/mp4/"`
done
# The ffmpeg options were generated by ChatGPT. Here is the description
class Clients::Convertkit
def tags
request(:get, "/tags")["tags"]
end
def get_subscriber_by_email(email:)
request(:get, "/subscribers", params: { email_address: email })
end
end
@mrhead
mrhead / wordle.json
Last active November 25, 2025 13:32
All Wordle words. Line number = wordle number.
[
"cigar", "rebut", "sissy",
"humph",
"awake",
"blush",
"focal",
"evade",
"naval",
"serve",
"heath",
# Add "status: :see_other" to redirects without explicit redirect status
#
# This is useful for migration to Turbo: https://turbo.hotwired.dev/handbook/drive#redirecting-after-a-form-submission
#
# Usage:
#
# ack redirect_to app/controllers | cut -f 1 -d : | sort -u | while read FILE; do ruby set_redirect_status.rb $FILE; done
unless filename = ARGV[0]
puts "Filename is required"
@mrhead
mrhead / convert_stimulus_targets.rb
Last active January 20, 2021 09:15
Convert Stimulus 1.x target syntax to Stimulus 2.0 target syntax
# Convert Stimulus 1.x target syntax to Stimulus 2.0 target syntax
#
# ack data-target app/views | cut -f 1 -d : | sort -u | while read FILE; do ruby convert_targets.rb $FILE; done
# ack data app/views | grep target: | cut -f 1 -d : | sort -u | while read FILE; do ruby convert_targets.rb $FILE; done
unless filename = ARGV[0]
puts "Filename is required"
exit(-1)
end
# https://3.basecamp.com/3293071/buckets/5610905/todos/3353537510
site = Site.find(23219) # futureofgood
csv = CSV.generate force_quotes: true do |csv|
csv << ["Name", "Email", "Signup Date", "Initial Article", "Signup Article"]
site.members.where("created_at >= ?", "2020-11-01").find_each do |member|
csv << [
member.full_name,
# Count number of words in a locale file.
def word_count(hash)
hash.values.sum do |value|
if value.is_a?(Hash)
word_count(value)
else
value.split.size
end
end
@mrhead
mrhead / memberful-wp-plus-wp-ultimate-recipe.php
Last active June 21, 2018 11:55
Memberful WP + WP Ultimate Recipe
<?php
$wp_ultimate_recipe_activated = in_array( 'wp-ultimate-recipe/wp-ultimate-recipe.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
$memberful_wp_activated = in_array( 'memberful-wp/memberful-wp.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
if ( $wp_ultimate_recipe_activated && $memberful_wp_activated ) {
add_action( 'wp', 'disable_wp_ultimate_recipe_content_filter' );
function disable_wp_ultimate_recipe_content_filter() {
global $post;