...do it (also try this jsfiddle). The children need to be block elements. The HTML ... The CSS .parent { display: table-cell; vertical-align: middle; width: 500px; height: 300px; } .child {}
Ruby bindings for Sundown, a fast and full-featured Markdown parser that lets you define renders for arbitrary output formats...
It is common in Rails 3.0 applications that you want to provide default views for a group of controllers. Let...
Download the dictionary from http://www.winedt.org/dict.html, e.g. http://www.winedt.org/dict/de_neu.zip unzip de_neu.zip mkdir ~/Documents/dic iconv -f UTF-16 -t...
...the case, you can omit this part. */ .absoluteCenter { max-height: 100%; max-width: 100%; } HTML Paragraph goes here...
How you order elements in the can have an effect on the (perceived) performance of the page. This script helps...
Sometimes you want to run a command forever, e.g. to compile a haml to html file on the console. Use this: $ while(true) do haml index.haml index.html; sleep 1.5; done
...capture will receive the String result from the block instead of the buffer. All html_safe? information on it is lost! A possible fix for capture Admittedly, you'll rarely...
Redactor is yet another WYSIWYG editor. It definitely has its weak points, but I want to point out that it...
Modern versions of Capybara include a finder method #ancestor which allows you to find a parental element using CSS or...
So I had the issue that User input (coming from many different sources and users) often contains the...
If you render markdown from user input, an attacker might be able to use this to inject javascript code into...
This only applies to RSpec below version 1.3.2. The issue has been fixed in RSpec 1.3.2, and most likely RSpec...
...allowed to be either a space or a nbsp. The step definitions require the htmlentities gem. Capybara This step is part of Spreewald! Then /^I should( not)? see the (?:number...
...0xC2.chr + 0xA0.chr regexp = Regexp.new(no_minus + "\\b" + Regexp.quote(amount) + (unit ? "( |#{nbsp}| )(#{unit}|#{Regexp.quote(HTMLEntities.new.encode(unit, :named))})" :"\\b")) expectation = negate ? :should_not : :should page.body.send(expectation, match(regexp)) end Webrat
When you have a localized website, you may want to redirect users to their preferred language when they visit the...
Ubuntu 12.04 LTS x64, Ruby 1.8.7, Rails 2.13, PDFKit 0.5.4, Phusion Passenger Apache 2 I ran into this, when I...
...clicks on .gallery-image.is-featured Code Save this to features/support/selectors.rb, or update your file: module HtmlSelectorsHelpers def selector_for(locator) case locator # Auto-mapper for BEM classes # # Usage examples: # the main...
...a mapping in #{__FILE__}" end end private def selectorify(string) string.gsub(/ /, '-') end end World(HtmlSelectorsHelpers...
One of the most common production errors are ActionController::MethodNotAllowed errors. They usually happen when someone reloads a form by...
This note describes a Cucumber step definition that lets you say: Then "Mow lawn" should be an option for "Activity...
There are several options, but most of them are impractical. The best way is to use the :ruby filter:
Styling button tags across all major browsers is not easy. Many times you should be fine by using the native...
Capybara will match elements outside of a page's tag. For example, the step definitions below match nodes in a...
...markdown << prose.to_str # make sure the prose gets escaped, even if it is an html_safe string markdown.gsub(/(\*\*)(.*?)(\*\*)/, ' \2 ').html_safe end alias_method :md, :custom_markdown
This cucumber step is useful for testing an image (looking at the src of the image). Then(/^I should see...