You must reconfigure the guest so it will get its own IP address: Shutdown the guest In the guest's VirtualBox settings, choose Network and switch the network adapter type...
...Unix) or ipconfig (Windows) You can now connect to this IP address using HTTP, SSH, etc. Note that by doing this your VirtualBox guest is fully exposed on the local...
...not play nice with gnome-open. You can fix the problem by uninstalling it: sudo apt-get remove exo-utils Note that this may also uninstall XFCE tools like xfce4...
Table Of Contents Flexbox wrapping Spacing Long content Prevent an image from being stretched or compressed Lock scroll chaining CSS variable fallback Using fixed width or height...
...The fixed height The fixed width Forgetting background-repeat Vertical media queries Using justify-content: space-between Text over images Be careful with fixed values in a CSS grid
To reduce download time, application servers usually serve content using gzip compression, if the browser supports it. When using a tool like Wget to explicitly download an application's response...
...the server responds with the uncompressed version: wget http://example.com/ If you are curious about the compressed file's size, pass the corresponding HTTP header: wget --header="accept-encoding: gzip...
By default, Twitter Bootstrap's print styles include printing links. /* Bootstrap's way of printing URLs */ @media print { a[href]:after { content: " (" attr(href) ")"; } } If you want to turn that...
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...
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...
You can use scheme-less URLs (or protocol-relative URLs) to have browsers use the current protocol (HTTP or HTTPS) when loading content referenced with such an URL.
...relative URL doesn’t contain a protocol. For example, http://stevesouders.com/images/book-84x110.jpg becomes //stevesouders.com/images/book-84x110.jpg Browsers substitute the protocol of the page itself for the resource’s missing protocol. Problem solved...
Sometimes you want to see what data you get through a TCP or UDP connection. For example, you want to know how a HTTP Request look like.
...easy with netcat. Example to listen on port 80 and the output gets to stdout. sudo nc -kl 80 It's also possible write it into a file:
...will never return the current element itself, even if the element matches the given selector. Require the attached file and you can now say: $('.container').findWithSelf('.selector')
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...
When you're getting this error, one possibility is that you've created a select field for an association instead of the associated object's id. Example: form.select :unit, Unit.for...
will be expected to deliver a real Unit object, whereas form.select :unit_id, Unit.for_select will make Rails typecast the String value from the select field to the unit...
You have to specify the environment with -e env_name or RAILS_ENV=env_name if you want to run a script on the server. at Rails 2 it's...
bundle exec script/runner -e env_name path/to/script.rb argument1 argument2 ... at Rails 3 it's rails runner RAILS_ENV=env_name bundle exec rails runner path/to/script.rb argument1 argument2...
...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...
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...
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:
JavaScript engines such as Google’s V8 (Chrome, Node) are specifically designed for the fast execution of large JavaScript applications. As you develop, if you care about memory usage and...
...what’s going on in your user’s browser’s JavaScript engine behind the scenes...
The colors in Rails log files are helpful when watching them but, since they are ANSI color codes like ^[[4;36;1m, can be annoying when you are reading the...
...that does just prints those control characters (like less or vim). Remove them with sed: cat staging.log | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m...
Sometimes you want Angular to watch an object only until a certain state is reached (e.g. an object appears in the scope). Angular's $watch returns a method that you...
...can call to remove that watch. For example: unwatch = $scope.$watch 'user', (user) -> if user?
unwatch()
...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...
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
...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...
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