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
# 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 |
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
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 |
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
[ | |
"cigar", "rebut", "sissy", | |
"humph", | |
"awake", | |
"blush", | |
"focal", | |
"evade", | |
"naval", | |
"serve", | |
"heath", |
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
# 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" |
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
# 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 |
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
# 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, |
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
# 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 |
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 | |
$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; |
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
# lib/raven/processor/remove_ip_address.rb | |
class Raven::Processor::RemoveIpAddress < Raven::Processor | |
def process(data) | |
data = data.with_indifferent_access | |
if data.dig(:user, :ip_address) | |
data[:user][:ip_address] = nil | |
end |
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 | |
function is_protected_post( $post_id = NULL ) { | |
global $post; | |
if ( $post_id === NULL ) | |
$post_id = $post->ID; | |
if ( in_array( $post_id, memberful_wp_posts_that_are_protected() ) ) | |
return true; |
NewerOlder