Note: We have card with all CSS centering options. You probably want to head over there and get an overview over what techniques are available for your use case and browser requirements.
The classical scenario: There's a parent div element and you want to center some arbitrary child element vertically inside of it. Here's how you do it (also try this jsfiddle).
The children need to be block e…
Rarely, you might want to rebuild all gems with native extensions, because they might be compiled against outdated system libraries, resulting in some warnings or even segfaults or other ruby errors.
You can do that using
gem pristine --all
This will reset all gems to a pristine state as if you'd reinstall them, and as a side effect, rebuild all native extensions.
The above command will also help you sorting out errors like this after a distribution upgrade:
libmysqlclient_r.so.16: cannot open shared object file: No such fil...
Ever wanted to preview a pattern from Subtle Patterns on your site without the hassle of swapping out images and modifying CSS?
Subtle Patterns Preview provides a simpler way to do it.
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.
A protocol relative URL doesn’t contain a protocol. For example,
Browsers substitute the protocol of the page itself for the resource’s missing protocol. Problem solved!
Internet Explorer 7 & 8 will download st…
Generally, Selenium tests use the browser to interact with the page. If it's unavailable, a timeout error is thrown.
Now, consider a scenario like this:
When the last step in the scenario passes, you are done. Right? Wrong.
What if clicking our "fancy link" above sends the e-mail that we expect, but it also does stuff on the server…
Our most recent pattern is
EMAIL = /\A[a-z0-9\+\-_\.]+@[a-z\d\-.]+\.[a-z]+\z/i
\w! Otherwise the pattern would allow
ßs and many other invalid characters.
a@ais valid). In result our pattern is more strictly.
Modern cameras often produce JPEGs that have a "I should be rotated 90° to the left" flag. If you process such pictures using Carrierwave this will be ignored and you'll end up with a wrongly rotated image.
Fortunately, this is easy to fix:
In your Uploader, add
process :auto_orient # this should go before all other "process" steps def auto_orient manipulate! do |image| image.tap(&:auto_orient) end end
Note: You can add the
process :auto_orient outside of all your
version blocks and it will apply…
Installation differs slightly from older versions, please check the README.
gleeBox is an experimental project that takes a keyboard-centric approach to navigating the web. It provides alternatives to actions that are traditionally performed via the mouse. Some of these are radically more efficient than using a mouse, some not so much. In all cases, they are mostly meant for keyboard and command line lovers.
Gleebox is a terrific plugin that makes navigating through webpages a wink. It even allows for selecting by jQuery selector.
Having your site run on SSL is worthless when you include content over an unsafe connection (HTTP).
Here is how to hunt down mixed content with Firefox.
If your Firefox does not warn you about mixed content on pages (mine did not), you can enable it again:
Visit about:config and search for
security.warn_viewing_mixed. If it's set to
false, set it back to
Firefox 16+ will show you mixed content in its "Web Co…
Browser rendinger engines very slow at rendering large box shadows. I had a situation where a complex layout with fixed elements and large shadows slowed Firefox down to 2 frames/second for scrolling and DOM manipulation.
Get the class name by calling
class_name, or the type of the association (belongs_to, has_many,…) by calling
Icon fonts like Font Awesome are infinitely scalable, look great on high-DPI displays and will give your app a modern look.
However, icon fonts can be very awkward to use compared to raster icons. Elements are given icons by giving them a special class like
The icon font's stylesheet will then recognize this class and insert the icon as the element's
In practice, this pattern will give you a lot of hea…
Under certain (unknown) circumstances, Rails will give localized files an invalid content-type in the Response header. For me, after requesting
corporate_information and rendering
corporate_information.de.html.haml, Rails sent a content-type of
de.html instead of the expected
Huge set of 315 free vector icons. You can choose which one you'd like, add your own SVGs, then download everything as an icon font or series of PNGs.
You can get up to 925 icons once you pay $59.
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.join with a clever twist:
url = 'http://www.foocorp.com:33546/foo/bar?query=foobar#hash' URI.join url, '/' # => http://www.foocorp.com:33546/