# In your Gemfile
gem "localhost"
# Then, depending on your desired server
gem "falcon"
gem "puma"
This file contains hidden or 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/sh | |
print_usage() { | |
echo "usage: compress_video <input_file>" | |
echo "supported formats: mp4, webm, mkv, mov, avi, flv" | |
} | |
get_extension() { | |
f="${1##*/}" | |
case "$f" in |
This file contains hidden or 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
# frozen_string_literal: true | |
class ApplicationService | |
def self.call(...) | |
new(...).call | |
end | |
def initialize(...) | |
end | |
end |
This file contains hidden or 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
import os | |
import fnmatch | |
def get_comment_prefix(filename): | |
extension_to_comment = { | |
'.asm': (';', ';'), | |
'.awk': ('#', '#'), | |
'.c': ('//', '//'), | |
'.clj': (';;', ';;'), | |
'.cpp': ('//', '//'), |
This file contains hidden or 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/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' | |
This file contains hidden or 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
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 |
This file contains hidden or 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 | |
if [ "$UID" == "0" ]; then | |
sudo_cmd='' | |
else | |
sudo_cmd='sudo' | |
fi | |
bash -c "$(curl -sL https://setup.vector.dev)" |
This file contains hidden or 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
# 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.
This file contains hidden or 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
FROM ruby:3.2.2-alpine | |
# ============================================================================================================ | |
# Install system packages | |
# ============================================================================================================ | |
RUN apk add --no-cache --update \ | |
bash \ | |
build-base \ | |
curl \ | |
gcompat \ |