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") |
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
unless RUBY_VERSION.start_with?("2.7") | |
puts "Please use Ruby 2.7.x" | |
return | |
end | |
data = File.open("input.txt").map { |line| | |
parts = line.split(" ") | |
p1, p2 = parts[0].split("-").map(&:to_i) | |
{ | |
p1: p1, |
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
numbers = File.open("input.txt").map(&:to_i) | |
combinations = ENV.fetch("COMBOS", 2).to_i | |
puts numbers | |
.combination(combinations) | |
.find { |pair| pair.sum == 2020 } | |
.reduce(:*) |
NewerOlder