Download the dictionary from http://www.winedt.org/dict.html, e.g. http://www.winedt.org/dict/de_neu.zip unzip de_neu.zip mkdir ~/Documents/dic iconv -f UTF-16 -t...
const wordBreaks = { 'Fahrsicherheitstraining': "Fahr\xADsicherheits\xADtraining", 'Fahrsicherheitszentrum': 'Fahr\xADsicherheits\xADzentrum', 'Kreisverkehrswacht': 'Kreis\xADverkehrswacht', 'Berufsgenossenschaft': 'Berufs\xADgenossenschaft', } const keys = Object.keys(wordBreaks) function textNodes(node){ let textNodes = [] let walk = document.createTreeWalker(node...
...get rather expensive and doing it for every long word does not make it better, but in my case the pages are not very content-heavy and there is no...
Inside before :each blocks you can refer to variables that you introduce via let later on. They do not need...
Rails comes with grouped_collection_select that appears to be useful, but isn't. As an alternative, consider the flat...
When the Ruby parser module of Ruby-GetText comes across a file in one of its search directories (e.g. lib/scripts...
When you use the send_file method to send a local file to the browser, you can save resources on...
CoffeeScript and JavaScript (ECMAScript) both have operators in and of. Each language use them for more than one purpose. There...
...calls html_safe if you're not escaping. FWIW, an HTML string may easily become invalid when truncated, e.g. when a closing tag gets chopped off. However, when the input...
...to a value. The validation is skipped silently when terms is nil. While this behavior is useful to validate acceptance in the frontend and not the admin backend, it also...
...polymorphic association. class Event < ApplicationRecord has_many :letters, as: :record end class Letter < ApplicationRecord belongs_to :record, polymorphic: true end event = Event.new.letters.build event.save! # => ActiveRecord::RecordInvalid: Validation failed: Record must exist...
Active Record's select method allows you to make use of the power of MySQL select statements. On the one...
If you use transactional_fixtures or the database_cleaner gem with strategy :transaction, after_commit callbacks will not be fired...
After updating Rubygems you see a wall of deprecation warnings like this: NOTE: Gem::SourceIndex#add_spec is deprecated, use...
If you migrate a Rails application from Sprockets to Webpack(er), you can either transpile your CoffeeScript files to JavaScript...
...new RegExp('^(\\d+) users') # => /^(\d+) users/ Our expression above now works only at the beginning of the matched string, looks for a number (\d+ [1]) and also captures that. Sweet...
...might have a negative impact on your application's performance. We did not yet benchmark it, but using it for elements that are rendered very often is probably a bad...
Two weeks ago, Cloudflare was struck by a global outage that lasted ~30 minutes. The incident was rooted on a...
...when you run a Selenium test with Capybara. This will help you understand "impossible" behavior of your tests. When you run a Rack::Test (non-Javascript) test with Capybara, there...
...you. But sometimes the complexity will bleed through, causing your tests to show "impossible" behavior. Here is some unexpected behavior caused by the interaction of threads and processes:
In order to request a SSL certificate from any dealer, you usually need a CSR certificate. As both the CSR...
If you are using scrum in a project you might be familiar with planning poker, a playful way to agree...
...nested, :inverse_of => :parent accepts_nested_attributes_for :nested end class Nested < ActiveRecord::Base belongs_to :parent validates_presence_of :parent_id # <- end With the parent already persisted creating nesteds...
...soften the validation to only validate on the associated object: class Nested < ActiveRecord::Base belongs_to :parent validates_presence_of :parent # <- without `_id` end Drawback With this softened validation now...
Angular comes with different types of services. Each one with its own use cases. All of these services are singletons...
By default, Devise redirects to a sign-in form when accessing a route that requires authentication. If for some reason...
...origin (e.g. git fetch and git status). You should be 0 commits ahead or behind. Add and commit a file touch .please-update git add .please-update
...is no way to make GitHub do this nicely. :( If you know of a better approach, please let me know...