tailwind_transformer.rb -> app/models/tailwind_transformer.rb | |
tailwind.rb -> config/initializers/tailwind.rb | |
tailwind.config.js.erb -> config/tailwind.config.js.erb | |
package.json -> ./package.json |
#!/bin/bash | |
# Usage: gh-rename-master <newbranch> [<remote>] | |
# | |
# Renames the "master" branch of the current repository both locally and on GitHub. | |
# | |
# dependencies: GitHub CLI v0.10 | |
set -e | |
newbranch="${1?}" | |
remote="${2:-origin}" |
This year, I preferred DotCSS to DotJS. Some talks were amazing and inspiring. The atmosphere was kind and I talked to some speakers ! (@frivoal, @natalyathree AAAANNNND @SaraSoueian <3 <3).
This talk was done by Florian Rivoal. He describes some new features to handle line-breaks and text-wrapping better. Some are already implemented in some browsers, some not. What I noted :
- Whitespace CSS rules (
pre
,preline
, etc.) use several steps to deal with whitespace.
queue = Sidekiq::Queue.new("default") | |
queue.each do |job| | |
if job.klass == "DailyFrequencyCreatorWorker" | |
DailyFrequencyCreatorWorker.set(queue: 'daily_frequency_creator').perform_async(*job.args) | |
job.delete | |
end | |
end;nil |
class Enumerator::Lazy | |
def compact | |
reject(&:nil?) | |
end | |
end |
I've been doing some work lately with JSON documents in PostgreSQL using jsonb
columns. You can query these documents
using a GIN index in PG, but the syntax can be a little cumbersome
SELECT "events".* FROM "events" WHERE "events"."body" @> '{"shift":{"user_id":2}}'
You have to construct the right side of the query as a JSON string, which is a bit annoying. So I wondered if I could adapt Arel to do the tedious stuff for me.
RouteTranslator gem is wrapping the current locale assignment in an around_filter set_locale_from_url and then resets it to the previous value.
Devise has a FailureApp to deal with unauthenticated requests, and it uses I18n to build the flash message and the redirection URL. But at that stage, the I18n default locale is set and the messages and URL are not localized in the context of the request (i.e. if the request URL is in French, and the default locale of the app is English, Devise will redirect to the English URL with an english flash message).
This is a solution for propagating the application locale to the the Devise middleware.
One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.
Let's take the example of simulating the rolling of a die.
We can represent a die as an array of its faces.
die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]