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
module TurboStreamsBroadcastExtensions | |
def broadcast_action_later_to(*streamables, action:, target: nil, targets: nil, attributes: {}, **rendering) | |
render_component_to_html(rendering) | |
super | |
end | |
def broadcast_action_to(*streamables, action:, target: nil, targets: nil, attributes: {}, **rendering) | |
render_component_to_html(rendering) | |
super | |
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
class DemoSteppedJob < SteppedJob | |
# without a retry_on, the job will not be retried where it failed | |
retry_on StandardError, attempts: 4 | |
def steps = %i[step_one step_two step_three] | |
private | |
def step_one(arg1, arg2) | |
Rails.logger.info("Step one with args #{arg1} and #{arg2}") | |
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
#!/bin/bash | |
string_to_search=$1 | |
num_commits=${2:-20} | |
if [ -z "$string_to_search" ]; then | |
echo "Usage: $0 <string_to_search> [<num_commits>]" | |
exit 1 | |
fi |
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
#!/bin/bash | |
set -e | |
s3_key=$BACKUP_S3_KEY | |
s3_secret=$BACKUP_S3_SECRET | |
bucket=$BACKUP_S3_BUCKET | |
backup_db_passphrase=$BACKUP_S3_DB_PASSPHRASE | |
data_directory=$SQLITE_DATABASE_DIRECTORY | |
# ensure each backup has the same date key | |
date_key=$(date '+%Y-%m-%d-%H-%M-%S') |
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
{%@ Shared::Card::Card as: :article do %} | |
{%@ Shared::Card::Title as: :h2, href: article.relative_url do %} | |
{{article.data.title}} | |
{% end %} | |
{%@ Shared::Card::Eyebrow as: :time, dateTime: article.data.date, decorate: true do %} | |
{{article.data.date}} | |
{% end %} | |
{%@ Shared::Card::Description do %} | |
{{article.data.description}} | |
{% 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
module Clsx | |
def clsx(*args) | |
process_args = args.map do |arg| | |
if arg.is_a?(Array) | |
clsx(*arg) | |
elsif arg.is_a?(Hash) | |
arg.map do |key, value| | |
key if value | |
end | |
else |
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
<script> | |
document.addEventListener("DOMContentLoaded", () => { | |
const url = new URL(window.location) | |
const email = url.searchParams.get("email_address") | |
if (email) { | |
document.querySelectorAll("input[type='email']").forEach((el) => el.value = email); | |
} | |
}); | |
</script> |
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
window.kolOptions = { | |
form: { | |
mappings: { | |
email: { | |
selector: "input[name='you_custom_selector']" | |
} | |
} | |
} | |
}; |
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 FlyGraphql | |
include HTTParty | |
debug_output $stderr if Rails.env.development? | |
base_uri "api.fly.io:443/graphql" | |
headers "Authorization" => "Bearer #{ENV["FLY_API_KEY"]}" | |
format :json | |
attr_reader :app_id | |
class FlyGraphqlError < StandardError | |
def initialize(message = "Error in FlyGraphql") |
NewerOlder