VirtualBox host IP address and hostname
When you are using NAT Show archive.org snapshot in your virtual machine (which you should), the host's IP address is:
10.0.2.2
You'll need it to access shared folders or your host's web server when testing pages in IE.
Fun fact: You could also use vbox.srv
-- that's the corresponding hostname.
Related cards:
Detect mobile or touch devices on both server and client
Although it's tempting flirt with detecting mobile/touch devices with CSS media queries or Javascript feature detection alone, this approach will be painful when heavily customizing a feature beyond just tweaking the looks. Eventually you will wan...
Ruby: Extract the hostname from a URL
url = 'http://www.foocorp.com/foo/bar'
URI.parse(url).host
# => www.foocorp.com
Note that this will raise an error if the given argument is not a URL.
If you need the host's full URL without path, query, fragment etc., use [`URI....
Webmock < 3.12.1 cannot handle IPv6 addresses correctly
We had the issue, that a VCR spec failed, after updating CarrierWave
from version 0.11.0
to 1.3.2
.
In this version, CarrierWave
uses the gem SsrfFilter
, which retrieves the IP addresses for the given hostname and replaces the hostname in...
How to change the hostname in Cucumber features
Capybara uses www.example.com
as the default hostname when making requests.
If your application does something specific on certain hostnames and you want to test this in a feature, you need to tell Capybara to assume a different host.
Given...
Configuring ActionMailer host and protocol for URL generation
When you generate a URL in a mailer view, ActionMailer
will raise an error unless you previously configured it which hostname to use.
There are t...
Danny O’Brien’s Oblomovka » Blog Archive » cd-roms and ipads
We’re not in the age of CD-ROMs now. Our price-points are all over the shop, and a sealed environment like the iPad permits all kinds of unnatural pricing inversions. We’ll pay more for a ringtone than a full MP3. We pay $10 for a README file on o...
German localization for Mobiscroll
If you are using Mobiscroll for date pickers on touch devices, here is how to localize the Mobiscroll UI into German:
var germanMobiscrollLocalization = {
...
Make an HTTP request to a machine but fake the hostname
Consider you have a website vhost listening to www.example.com
, redirecting all incoming requests that do not talk about the configured hostname (this is often used to redirect users to http://www.example.com
when entering only `http://example...
How to get the hostname of the current machine in Rails or a Ruby script
Use Socket.gethostname
. So for a machine whose hostname is "happycat", it will look like this:
>> Socket.gethostname
=> "happycat"
That should work right away for your Rails application. For plain Ruby, you first need to do:
requi...
Defining host aliases in your SSH config
You probably already manage servers you often connect to inside the ~/.ssh/config
file. What is nice: you may define alias names for hosts so that you can say something like ssh foobar-staging
.
This is especially helpful for servers whose hos...