Weird margin at top of page
If there is some weird margin at the top of your page for no apparent reason, chances are one of your views contains a BOM (Byte Order Mark) Show archive.org snapshot .
To remove it, open the file with VIM, and type
:set nobomb
:wq
Related cards:
Scaling Pinterest - From 0 to 10s of Billions of Page Views a Month in Two Years
Awesome battle report from Pinterest trying to scale their setup using different approaches.
When you push something to the limit all technologies fail in their own special way. This lead them to evaluate tool choices with a preference for tool...
Fix REPL of better_errors page
The gem better_errors offers a detailed error page with an interactive REPL for better debugging.
I had the issue that on a few ...
You should probably load your JavaScript with <script defer>
It is generally discouraged to load your JavaScript by a <script src>
tag in the <head>
:
<head>
<script src="app.js"></script>
</head>
The reason is that a <script src>
tag will pause the DOM parser until the script has l...
Top 10 Email Developments of 2015
You know that layouting HTML e-mails is terrible.
For more fun, check Litmus' list of top 10 e-mail developments of 2015 that did not make things better.
Tearing Down Capybara Tests of AJAX Pages
An all-in-approach to fix the problem of pending AJAX requests dying in the browser when the server ends a test or switches scenarios.
We were able to work ...
What collapsing margins are, how they work and when margins do not collapse
Imagine you have 2 HTML boxes. The first one has a margin-bottom
of let's say 30px
and the second one a margin-top
of 20px
. After rules of collapsing margins have been applied we ha...
Stretching an HTML page to full height
This card existed before, but was outdated due to browser implementation changes. The information below is validated for the current list of browsers we support.
By default your html
and body
elements are *only as high as the a...
Howto remove the location hash without causing the page to scroll
Set the hash to a dummy hash which doesn't hit any id
at your page, for example:
window.location.hash = "_";
Note
- If you'd set the hash to
""
it causes the page to scroll to the top because the hash"#"
by itself is equivalent...
Beware of rails' reverse_order!
#reverse_order
does not work with complex sorting constraints and may even silently create malformed SQL for rails < 5.
Take a look at this query which orders by the maximum of two columns:
Page.order('GREATEST(pages.published_from_de, pag...
Showing a custom maintenance page while deploying
Note
The maintenance mode is enabled on all application server as soon as the file
/public/system/maintenance.html
is present.
Installation
Add this line to your application's Gemfile:
gem 'capistrano', '~> 3.0'
gem 'capistrano...