lorempixel - placeholder images for every case
Generate dummy images for a given dimension and topic.
Related cards:
Generating test images on the fly via JavaScript or Ruby
When you need test images, instead of using services like lorempixel or placehold.it you may generate test images yourself.
Here we build a simple SV...
A solid and unobtrusive plugin for form field placeholders
jquery-placeholder
is a simple jQuery plugin that enables form placeholders in browsers that do not support them natively, i.e. IE < 10.
Properties
- Works in IE6.
- Automatically checks whether the browser natively supports the HTML5 place...
Capybara: A step for finding images with filename and extension
This cucumber step is useful for testing an image (looking at the src
of the image).
Then(/^I should see the image "([^"]*)"$/) do |filename_with_extension|
expect(page).to have_css("img[src*='#{filename_with_extension}']")
end
...
Graticule computes NULL distance for some records (and how to fix that)
The SQL code generated by Graticule's spherical distance computation is insufficient and can lead to NULL
distances in edge cases.
...
Add an alternative image source for broken images
Awesome hack by Tim VanFosson:
<img src="some.jpg" onerror="this.src='alternative.jpg'" />
Fixing Graticule's "distance" for edge cases
Ever seen this error when using Graticule?
Numerical argument out of domain - acos
Similarly to the [to_sql
problem for some edge cases](https://makandracards.com/makandra/3381-graticule-computes-null-distance-for-some-records-and-how-to-f...
Optimizing images for the web
For webpages to load fast it's recommended to optimize images. Ideally an image's file size should be as small as possible while still being of decent quality. This card demonstrates two command line tools for image optimization
Use identify
to...
Declare different CSS background-images for different locales
If you would like to use language specific layout (e.g. background-images) in your applications stylesheets you can achieve this easily by using the lang
attribute in your views (ERB):
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%...
Rendering 404s for missing images via Rails routes
When you load a dump for development, records may reference images that are not available on your machine.
Requests to those images may end up on your application, e.g. if a catch-all route is defined that leads to a controller doing some heavy l...
Setting expiry dates for images, JavaScript and CSS
When deploying Rails applications you might have noticed that JS and CSS are not cached by all browsers.
In order to force Apache to add expiry dates to its response, add the attached .htaccess
to the public directory. This will add a header su...