In large forms (30+ controls) new Capybara version become [extremely slow] when filling out fields. It takes several seconds per input. The reason for this is that Capybara generates a...
...huge slow XPath expression to find the field. The attached code patches fill_in with a much faster implementation. It's a dirty fix and probably does a lot less...
ZSH is an alternative command line shell that includes some features like spelling correction, cd automation, better theme, and plugin support. You can replace Bash with ZSH like following:
...apt-get install zsh Setting ZSH as default login shell sudo usermod -s /usr/bin/zsh $(whoami) Opening a new terminal window will show you a dialog where you can configure your...
DevDocs combines multiple API documentations in a fast, organized, and searchable interface. Here's what you should know before you start: You don't have to use your mouse — see...
...the list of keyboard shortcuts The search supports fuzzy matching (e.g. "bgcp" brings up "background-clip") To search a specific documentation, type its name (or an abbreviation), then Tab
In rare cases you might need something like form_for (for using form builder methods on the resulting block element) but without the surrounding form. One such case would be...
...updating some of a form's fields via XHR. You can simply use Rails' fields_for to do things like this in your views (HAML here): - fields_for @user do...
change_association :parent, class_name: 'Parent::AsForm', inverse_of: :children end When saving a Parent::AsForm record with nested Child::AsForm records, the children will not be saved...
...case where you override the association with has_many :children,...
...and belongs_to :parent, .... Solution This can be fixed with appending autosave: true to the Parent model: class Parent < ApplicationRecord...
Using ActiveRecord's #signed_id and .find_signed methods you can create URLs that expire after some time. No conditionals or additional database columns required...
Rails ships with two separate build pipelines: Sprockets ("asset pipeline") and Webpacker. Webpacker has many more moving parts, but allows us to use ES6 modules and npm packages (through Yarn...
...does for JavaScript roughly what Bundler does for Ruby. Read the first couple of sections of its official documentation. You should learn how to: Install and update packages Remove packages...
...frame('iframe-id') do fill_in 'E-mail', with: 'foo@bar.com' fill_in 'Password', with: 'secret' click_button 'Submit' end Instead of the frame's [id] attribute you may also pass...
If you're also using Cucumber you could make a meta-step like this: When /^(.*?) inside the (.*?) frame$/ do |step_text, frame_id| page.within_frame(frame_id...
...end up with web page bloat. But loading a webpage is much more than shipping bytes down the wire. Once the browser has downloaded our page’s scripts it then...
...dive into this phase for JavaScript, why it might be slowing down your app’s start-up & how you can fix it. The article author also tested 6000+ production sites...
S3cmd is a free command line tool and client for uploading, retrieving and managing data in Amazon S3. S3cmd reads its configuration by default from ~/.s3cfg, which is created once...
...you run s3cmd --configure. If you have many configurations, we recommend to always specify the configuration you want to use. This prevents applying actions to the wrong bucket. Examples:
...you upgraded it everywhere. But because it's FreeBSD it does not restart running services. After every old version is removed from /var/cache/pkg you restarted collectd and it does not...
...start anymore, you really want to downgrade to 5.8.1 again. But even pkg now has 5.9.0 and you need your own make config setup anyway. portdowngrade Enter portdowngrade. Install it...
When you need the DOM node of a tag (e.g. to read extra attributes, or to modify the DOM near it), you can usually reference it via document.currentScript. However, document.currentScript is unsupported in ancient browsers, like Internet Explorer 11 or wkhtmltopdf's Webkit engine. If you are not running async scripts, you can easily polyfill it: document.scripts[document.scripts.length - 1] It works because document.scripts grows with each tag that was evaluated. That is also the reason why this solution will not work reliably for async code. Demo: https://codepen.io/foobear/pen/poRLxQm
...format ("2021-02-22T20:34:53.686Z") Google API guideline: https://google.aip.dev/ Numbers: String vs. Number The JSON number type is not a double. It's just a number...
...parsed as whatever the parser finds fitting. Pagination: Limit + Offset vs. Object ID / Pointer vs. System-Version Tables Filter Attributes e.g. ?fields=f1,f2,f3 Version in path (/api/v1/) or...
...duplication from the code is a seemingly easy task. In many cases it is pretty straight-forward – you look at similar bits of code and you move them to a...
...in other places. Right? No, not really. It is true that code that looks similar might be an indicator that there’s a duplication but it’s not the definitive...
...with more than one developer should always consider to enforce code review even for small changes to improves the overall code health of the system. Here are some guidelines that...
...perfect pull request Google Google's Engineering Practices documentation Modern Code Review: A Case Study at Google Thoughtbot Thoughtbot' Code Review Guideline
jQuery is still a useful and pragmatic library, but chances are increasingly that you’re not dependent on using it in your projects to accomplish basic tasks like selecting elements...
...styling them, animating them, and fetching data—things that jQuery was great at. With broad browser support of ES6 (over 96% at the time of writing), now is probably a...
...Invoked Function Expessions (or IIFEs) to prevent local variables from bleeding into an outside scope: (function() { var foo = "value"; // foo is scoped to this IIFE })(); In Coffeescript an IIFE looks...
(-> foo = "value" # foo is scoped to this IIFE )() There is also a shorthand syntax with do: do -> foo = "value" # foo is scoped to this IIFE
...run by your web browser. As any JavaScript, you include a link to the script in your HTML, and…that’s that. LESS is now going to process LESS code...
...formatting. Headers, paragraphs, lists, it’s all good. What about the formatting of text in single-line text fields? If our form entry is a single line, that’s usually...
...model inherits from others or uses many concerns / traits, it might be hard to see in the code which validators it has. But fortunately there's a method for that...
...UniquenessValidator:0x00007f55f1417e88 @attributes=[:name], @klass=UserGroup (call 'UserGroup.connection' to establish a connection), @options={:case_sensitive=>true, :scope=>:partner_id}>, #<ActiveModel::Validations::NumericalityValidator:0x00007f55f1415200 @attributes=[:user_count_limit], @options={:greater_than...
There are several gems that make it easy to read and process xlsx files. Parsing the entire file at once however is error-prone since each cell is transformed to...
...formatted but empty cells. As of today, I found two promising alternatives that provide a stream-based access to spradsheet rows: Roo supports multiple spreadsheet types like ODS or CSV...
...behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec output is incredibly noisy. You could silence all warnings with ::ActiveSupport::Deprecation.silenced = true, but you...
...dependencies. It’s tempting to remove the tests altogether (the code will be burned soon too, right?), but I figured out something a little nicer a little while back in...
...code from your repository. In order to do so, Capistrano connects to your repository server from the application server you're deploying to with SSH. For this connection you can...
...use two SSH keys: the user's ~/.ssh/id_rsa [default] the very same key you used for connecting to the application server - forwarded automatically to the git repository.
...was missing some features on Ruby's RSS::Parser that I found in Feedjira: Speed Does not break on slightly malformed RSS feeds (like a missing length attribute on an...