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
# 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)}" |
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
/ spec/components/previews/forms/simple_form_preview/basic_form.html.slim | |
= simple_form_for(mail_search_object, url: "/fake/search") do |f| | |
= f.input :to | |
= f.input :subject, hint: "Explanation for this field" | |
= f.button :submit, "Search" |
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
# media query: tachyons postfix (-mq) => tailwind prefix (mq:) | |
variants: | |
ns: sm | |
l: lg | |
# tachyons_class => tailwind_class | |
replacements: | |
# paddings | |
pa0: p-0 |
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/env ruby | |
# Migrate classes in the whole project using configuration in `tachyons_to_tailwind.yml`. | |
# Intended for migrating Tachyons utility CSS to Tailwind CSS. | |
# | |
# See https://dev.to/nejremeslnici/migrating-tachyons-to-tailwind-css-part-i-ich for more context. | |
# | |
# To use this, do the following: | |
# | |
# Make this scrint executable: `chmod a+x tachyons_to_tailwind.rb`. |
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/env ruby | |
# Compare classes between Tachyons & Tailwind | |
# | |
# Please read https://dev.to/nejremeslnici/migrating-tachyons-to-tailwind-css-part-i-ich for more context. | |
# | |
# To use this, do the following: | |
# Install css_parser gem (https://github.com/premailer/css_parser) | |
# - `gem install css_parser` | |
# |
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
require "nokogiri" | |
require "open-uri" | |
require "csv" | |
# set the petition_name, e.g. for https://www.petice.com/puste_tatinky_k_porodu: | |
petition_name = "puste_tatinky_k_porodu" | |
# if you want to add later signatures, set the first page number to retrieve | |
from_page = 1 | |
rows_per_page = 100 |
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 | |
database="MY_DATABASE" | |
altered_tables=0 | |
function fatal { | |
echo "FATAL: $1" >&2 | |
echo "Exiting now." >&2 |
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 | |
# "panic button" when run in a for loop: | |
# exit | |
database="MY_DATABASE" | |
export_dir="/mnt/backups/my-archive" | |
set -e |
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 | |
function usage { | |
echo "Use ./run_ghost.sh table_name 'alter_command' [other_ghost_args]" | |
exit 1 | |
} | |
database="MY_DATABASE_NAME" | |
table=$1 |
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/env ruby | |
# | |
# Collects info about the age of all gems in the project | |
# | |
require "json" | |
require "date" | |
bundle = `bundle list` | |
yearly_stats = {} |
NewerOlder