...t easily customizable. Example usage /slackfont Comic Neue to use "Comic Neue" (if installed) /slackfont system-ui to use your desktop's system font in Slack. /slackfont (without an argument...
...the default font. Some fonts may be unavailable If you installed Slack through Snap, only system-wide installed fonts (i.e. fonts located in /usr/share/fonts/ or /usr/local/share/fonts/) are available.
...you can use reset: user.posts.reset # discards cache, but does not load anything yet user.posts # SQL query happens to load new state # => [...] Note that reset returns the association/scope. Hence, the above...
...will not seem to work on the Rails console, just because the return value is inspected and thus resolved right away. Try it like this: user.posts.reset; nil # no query
...USERNAME" to be a collision. If you use MySQL this will lead to issues, since string comparisons are case-insensitive in MySQL. (If you use PostgreSQL, read this instead.)
...and "USER", this will not trigger a validation error, but may fail with an SQL error due to duplicate index key. You can change Rails' behaviour, by saying
To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with the DISTINCT statement. To retrieve the group wise maximum of...
...columns: You can keep only one record for each group with the DISTINCT ON statement, to omit equal rows within each specified group. Use case You have a query where...
PostgreSQL offers a really handy field type: json. You can store any JSON there, in any structure. While its flexibility is great, there is no syntactic sugar in Rails yet...
...returns JSON, whereas ->> returns text. Note that the key(s) must be passed with single quotes. Updating records is not supported for json columns. jsonb columns can be updated, but...
Canonical does not ship Ubuntu 24.04+ Vagrant images due to HashiCorps switch to the Business Source License (BSL). There is currently no open source fork of Vagrant. Alternatives
...cloud-image/ubuntu-24.04 which can be used. Caveats The images are unmodified but unofficial. Sharing via the /vagrant folder is not possible. Use SSH/SFTP instead...
When RSpec sets out to print any given object to the console, it will never print more than 200 characters from it. Only the first and last 100 chars from...
...overly long strings are displayed, which sometimes means that the root cause for the failing test is buried in truncation. For example, I could not easily make out the reason...
...listen to other events. Quirks The "default behavior" in this case is not to show an alert, and preventing this default means the alert is being shown. In ancient browsers...
...customize the alert text, but this is no longer possible. You might want to set event.returnValue = true, as a truthy returnValue was necessary to trigger the alert in Chrome...
When testing your command line application with Aruba, you might need to stub out other binaries you don't want to be invoked by your test. Aruba Doubles is a...
Install the gem as instructed by its README, then put this Before block somewhere into features/support: Before do ArubaDoubles::Double.setup prepend_environment_variable 'PATH', ArubaDoubles::Double.bindir + ':' end
Im using the terminator terminal with the keyboard shortcut Control+Shift+E for splitting the terminal. I got used to this shortcut. Yesterday the Ubuntu update seems to have upgraded...
...ibus, which got this emoji picker that also uses Control+Shift+E to open. You can change this behaviour by opening the ibus setup from the console: ibus-setup
+:name => "Foo", +:thread => {:id=>1, :title=>"Bar"}, Instead you need to do something like this: describe 'user' do let(:user) { {id: 1, name: 'Foo', thread: {id: 1, title...
...relation you have to map the attributes and mutate for indifferent access or use string hash keys users.map(&:attributes).to include(hash_including('name' => 'Some name...
...its table name and id, use the following approach on ActiveRecord::FixtureSet: table = 'users' # Specify the fixture table name id = 123122 # Specify the ID to look for # Find the fixture...
@model_class= User(id: integer, ...)> # Associated model class ] Replace 'users' with the specific table/fixture name you are targeting. Replace 123122 with the desired ID for the lookup.
...not on par with your IDE of choice. I have found that it also slows down my IRB in some cases, or that pressing the Backspace key does not always...
...annoying than useful. You may disable multi-line autocomplete by using the --nomultiline commandline switch (for Rails, use bin/rails console -- --nomultiline), or specifying IRB.conf[:USE_MULTILINE] = false in your ~/.irbrc...
Ruby has this handy block shortcut map(&:to_i) for map { |x| x.to_i }. However, it is limited to argument-less method invocations. To call a method with an argument...
...list of hashes (imagine using a JSON API): users = [ { name: 'Dominik', color: 'blue' }, { name: 'Stefan', color: 'red'} ] names = users.collect do |user| user[:name] end If you're using Rails...
When users type into a Tom Select control, the options list is updated with a short delay which can feel too long. Here is how to adjust it. Background
...users can filter options by typing into the Tom Select control. However, after typing there is a 300ms delay until the options list is filtered. This can be especially annoying...
If you're on Ruby 2.3+ there's a <<~ operator to automatically unindent HEREDOCs: str = <<~MESSAGE Hello Universe! This is me. Bye! MESSAGE If you have an older Ruby, you...
...can use the String#strip_heredoc method from ActiveSupport. See Summarizing heredoc in ruby and rails for an example. Technically, it looks for the least indented line in the whole...
The terraform documentation states the...
...syntax as (grouping mode*. See: Grouping-Results). But this seems not the be the whole truth. Instead the...
...syntax behaves like Go's Ellipsis expression...
...is only available for for expressions. This can be especially useful when creating data structures in loops: users = { users = { "Bob.Bobster" = { name = { given_name = "Bob" family_name = "Bobster" } email = "bob.bobster@foobaringen.com"
Wondering how a specific method on an object is exactly named? You can use Enumerable#grep to detect it in the array of methods. @user.methods.grep /name/ # => [:name, :first_name, :last...
...also call #private_methods or #public_methods. To find only relevant methods, it is suggested to subtract generic methods like this: User.methods - Object.methods User.methods - ActiveRecord::Base.methods @user.methods - Object.instance_methods
...front of our eyes and humans consume PDF content all the time with great success. Why would it be difficult to automatically extract the text data? Turns out, much how...
...check checkboxes. But there's one problem, if you want to test a custom styled checkbox, which hides its -Tag: The methods cannot (un)check checkboxes without an visible .
...error message will be something like: Unable to find visible checkbox "Some label" that is not disabled Solution 1 Use the keyword argument allow_label_click: true within the method...
These two addons will change your life: Search as list This will always open search results in the list views instead of the barely usabely faceted search view.
...results by date not relevance Does what it says...
...an element's attributes in Capybara. A few examples: find('#my_element')['class'] # => "first-class second-class" find('#my_input')['placeholder'] # => "My placeholder value" find('a#example-link')['href...
There is a practical short list for valid/invalid example email addresses - Thanks to Florian L.! The definition for valid emails (RFC 5322) can be unhandy for some reasons, though.
...provides a built-in email regex URI::MailTo::EMAIL_REGEXP. That's the best solution to work with. /\A[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0...
...gems and whether an update is available All config variables and their values Capistrano server config $ bundle exec cap staging doctor