# In your Gemfile
gem "localhost"
# Then, depending on your desired server
gem "falcon"
gem "puma"
#!/bin/sh | |
# link UMC (Universal Modeline Calculator): | |
# https://sourceforge.net/projects/umc/files/umc/umc-0.2/umc-0.2.tar.gz/download | |
# compile umc with: "./configure" and "sudo make install" if error install dependencies and repeat. | |
# chmod +x monitor.sh | |
# ./monitor.sh | |
# Alias on .zshrc | |
# alias monitor='~/monitor.sh' | |
require 'fileutils' | |
# Loop through all .jpg and .png files in the current directory | |
Dir.glob("{*.jpg,*.png}").each do |img| | |
# Construct the output filename with .webp extension | |
output_filename = "#{File.basename(img, File.extname(img))}.webp" | |
# Execute ffmpeg command to convert the image | |
system("ffmpeg -i '#{img}' '#{output_filename}'") | |
end |
#!/bin/bash | |
if [ "$UID" == "0" ]; then | |
sudo_cmd='' | |
else | |
sudo_cmd='sudo' | |
fi | |
bash -c "$(curl -sL https://setup.vector.dev)" |
# frozen_string_literal: true | |
module Broadcastable | |
extend ActiveSupport::Concern | |
def prepend_operation(options = {}) | |
operation = {html: ApplicationController.render(partial: to_partial_path, locals: locals)} | |
operation.merge options | |
end |
What if I told you that it's possible to get helpful failure messages from basic asserts
using idiomatic equality ==
checks? No DSLs in sight.
This is a proof of concept to demonstrate that it's possible... mostly to satisfy my own curiosity. The concepts here could theoretically be expanded to provide a useful extension to existing testing frameworks or perhaps lay a foundation for an entirely new one.
This experiment created with Ruby 3.0.1. Note to self: There's probably a way to do this with TracePoint
instead of monkey patching but I couldn't figure out how to get a reference to the passed variable being compared.
FROM ruby:3.2.2-alpine | |
# ============================================================================================================ | |
# Install system packages | |
# ============================================================================================================ | |
RUN apk add --no-cache --update \ | |
bash \ | |
build-base \ | |
curl \ | |
gcompat \ |
I created this to help me run benchmarks/comparisons against Universal ID, but it could serve as the foundation for a robust ETL data pipeline... and it's less than 70 LOC right now! 🤯 🚀
It handles the extract and transform parts of an ETL process and supports the following options:
only
- specify which attributes to include
class BlurhashAnalyzer < ActiveStorage::Analyzer::ImageAnalyzer::Vips | |
def metadata | |
read_image do |image| | |
if rotated_image?(image) | |
{ width: image.height, height: image.width } | |
else | |
{ width: image.width, height: image.height } | |
end.merge blurhash(image) | |
end | |
end |