require 'open3' | |
require 'reline' | |
class Reline::LineEditor | |
private def perform_completion(list, _just_show_list) | |
_preposing, target, _postposing = retrieve_completion_block | |
namespace = IRB.CurrentContext.io.retrieve_doc_namespace(target) | |
namespace = namespace.first if namespace.is_a?(Array) | |
if namespace.nil? || !('A'..'Z').include?(namespace[0]) | |
namespace = IRB.conf[:__MAIN__] |
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG | |
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT. | |
# | |
# | |
# Libraries and infrastructure | |
sudo apt update -y | |
sudo apt install -y \ | |
docker.io docker-buildx \ | |
build-essential pkg-config autoconf bison rustc cargo clang \ |
# frozen_string_literal: true | |
module Fingerprinting | |
def full_fingerprint | |
generate_fingerprint( | |
ip_fingerprint, | |
browser_fingerprint | |
) | |
end |
# syntax = docker/dockerfile:1 | |
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | |
ARG RUBY_VERSION=3.2.2 | |
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base | |
# Rails app lives here | |
WORKDIR /rails | |
# Set production environment |
Disabling Selenium Chrome Automation Banner and Save address?, Save card?, and Save password? Pop Ups
Image: Pencil Sharpener by Wendy Bayer
This shows you how to disable those Chrome Save address?, Save card?, and Save Password? pop up windows in Selenium Webdriver
# This is a thin wrapper of the Simple Form builder. It delegates rendering the resulting form fields to Simple Form | |
# but typically amends the Tailwind classes of the various elements in the field layout. It tightly integrates with the | |
# unstyled wrapper (aka `:plain`) Simple Form configuration (see `simple_form.rb`). The methods support the same syntax | |
# as the original Simple Form methods but enhance it to support replacing defaylt Tailwind claseses. | |
class Builders::TailwindFormBuilder < SimpleForm::FormBuilder | |
# This is the basic method for rendering `<input>` tags and their variants. | |
def input(attribute_name, options = {}, &block) | |
# The default Tailwind classes for the various parts of the Simple Form wrapper layout. | |
input_class = "block w-full sm:text-sm ... #{'text-gray-500 bg-gray-50' if options.dig(:input_html, :disabled)}" |
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 |
class Chart < ApplicationRecord | |
validate do |chart| | |
schema = Rails.cache.fetch("vega_lite_schema/v5") do | |
Faraday.get("https://vega.github.io/schema/vega-lite/v5.json").body | |
end | |
JsonSchemaValidator.new(chart, schema: schema, json: vega_json, field: :vega_json).validate | |
end | |
end |
In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.
After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.
But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.
And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?
In dark rooms, in hushed tones, we speak of colours.