Preloaders.net - AJAX loading GIF and APNG spinners, bars and 3D animations generator
Generated animations are free to use without backlink obligations...
... WITH THE EXCEPTION of any other animated images generator applications
Haha :)
Related cards:
How to create Rails Generators (Rails 3 and above)
General
Programatically invoke Rails generators
: Require the generator, instantiate it and invoke it (because generators are Thor::Group
s, you need to invoke them with invoke_all
). Example:
require 'generators/wheelie/haml/...
Waiting for page loads and AJAX requests to finish with Capybara
If you're using the Capybara webdriver, steps sometimes fail because the browser hasn't finished loading the next page yet, or it still has a pending AJAX request. You'll often see workarounds like
When I wait for the page to load
Then .....
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...
Andand and SimpleDelegator
The very useful andand gem does not play very nice with Ruby's SimpleDelegator (or vice versa).
This following will not work:
class MyDecorator < SimpleDelegator
def foo
end
end
...
Loading dumps via SSH, unpacking and sourcing them, all with a progress bar
Here is a hacky way to load dumps directly from the source server, without fully copying them over and extracting them first.
It [may break horribly for you](https://makandracards.com/makandra/595-dumping-and-importing-from-to-mysql-in-an-utf-8-s...
Stop animations and network polling when the document tab isn't visible
Is your application doing something expensive every few seconds? Maybe an animated slider that rotates images? Maybe you are updating data over the network every five minutes?
It's a good idea to pause this if the your document tab is not eve...
Unobtrusive JavaScript and AJAX
Attached (see below) is some code to allow using unobtrusive JavaScript on pages fetched with an AJAX call.
After you included it, you now do not use the usual
$(function() {
$('.some_tag').activateStuff();
});
any more, but i...
SecureRandom -- Stop writing your own random number and string generators - Momoro Machine
Stop writing your own random string generators. Rails does this for you.
Cross-Domain Data with Rack and Rails | Union Station
Asynchronous JavaScript and CSS, also known as CSSHttpRequest, is a method of URI-encoding data in 2KB chunks split over several CSS rules with a modified data URI scheme. Because CSS is not subject to the same-origin policy, no service proxy is r...