![image](https://private-user-images.githubusercontent.com/1523305/293961619-b1d71975-f0a5-4127-8214-e36e2a58d3f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NTg1NTUsIm5iZiI6MTcyMTc1ODI1NSwicGF0aCI6Ii8xNTIzMzA1LzI5Mzk2MTYxOS1iMWQ3MTk3NS1mMGE1LTQxMjctODIxNC1lMzZlMmE1OGQzZjYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjNUMTgxMDU1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzNjMmI5OTdhYTNjNDc5NDA5MmQ0YzIyNzdmNTQ1NWE4NWY5Y2E5NmMwMTUzNWE0ZjhmZTZjMTU5OTgzODhjZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.uJ7lmrwFRN48MbHEGeN47iQUFesP038RLUWoheKc7cU)
![image](https://private-user-images.githubusercontent.com/1523305/293961619-b1d71975-f0a5-4127-8214-e36e2a58d3f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NTg1NTUsIm5iZiI6MTcyMTc1ODI1NSwicGF0aCI6Ii8xNTIzMzA1LzI5Mzk2MTYxOS1iMWQ3MTk3NS1mMGE1LTQxMjctODIxNC1lMzZlMmE1OGQzZjYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjNUMTgxMDU1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzNjMmI5OTdhYTNjNDc5NDA5MmQ0YzIyNzdmNTQ1NWE4NWY5Y2E5NmMwMTUzNWE0ZjhmZTZjMTU5OTgzODhjZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.uJ7lmrwFRN48MbHEGeN47iQUFesP038RLUWoheKc7cU)
#!/usr/bin/env ruby | |
# Run like `ruby incompat_71.rb ~/path/to/Gemfile.lock` | |
# From the team at infield.ai | |
# | |
PACKAGES = [['activerecord-import', '1.5.0'], | |
['anycable-rails', '1.4.1'], | |
['blazer', '3.0.1'], | |
['bullet', '7.1.2'], | |
['data_migrate', '9.2.0'], | |
['database_cleaner-active_record', '2.1.0'], |
KAMAL_REGISTRY_PASSWORD=dckr_pat_xXXxx_x0xXxXx-xX-XXX0xX0x-x | |
RAILS_MASTER_KEY=00x00xxx000xxx000000xx0x000x0x00 | |
POSTGRES_PASSWORD=xXxxx0xXXx0 | |
MEILI_MASTER_KEY=xXxxx0xXXx0 | |
BLAZER_DATABASE_URL=postgres://service:{POSTGRES_PASSWORD}@service-name-postgres:5432/service_production |
import { Controller } from "@hotwired/stimulus" | |
// use with Rails' `time_Tag` helper like so: | |
// <%= time_tag campaign.starts_at, campaign.starts_at.to_formatted_s(:short), data: { controller: "localized-time", localized_time_type_value: "datetime-short" } %> | |
export default class extends Controller { | |
static targets = [ ] | |
static values = { | |
type: String, | |
style: { type: String, default: 'medium' }, | |
locale: { type: String, default: 'default' }, |
// Plain ol' JavaScript module for fetching feature flags from the server | |
// | |
// import { isEnabled } from './flipper.js' | |
// | |
// if (await isEnabled("new_feature")) { | |
// // render new feature | |
// } else { | |
// // render old feature | |
// } | |
// |
For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.
Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.
FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
# 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)}" |
#!/usr/bin/env ruby | |
# Given a file and method_name | |
# Show all the different implementations across the git history (first commit per implementation). | |
# | |
# show_method_history <file> <method_name> --html | |
# | |
# e.g. show_method_history test/test_helper.rb sign_in --html | |
# | |
# WARNING: the --html output just dumps html files into your current folder. | |
# |
Add the following to application.rb
:
$icallbacks = []
$icallbacks.define_singleton_method(:print) do
puts sort_by { |(a, b)| -b }.map { |(a, b)| "#{b}\t\t#{a}" }.join("\n")
end
ActiveSupport::Notifications.subscribe("load_config_initializer.railties") do |event|
$icallbacks << [event.payload[:initializer], event.duration]
# This demonstrates how we create a SEO friendly url for the previews of the artworks we sell. | |
# | |
# This is the URL we want: | |
# https://festalab.com.br/image/invitation/birthday/carnival.jpg | |
# | |
# First, the route. | |
# | |
# "model" is the name of the active storage model that has the preview. | |
# "classification" and "identifier" are together a unique key for the records. |