phrogz.net

...non-default behavior that you know from other tags. Do not try to style html or body for positioning, width/heigth, or similar. Every browser has its own caveats and you...

...can not test them all. Generally speaking: Use the html tag to define your page's default background color (because on short pages or large screens, your body may not...

tl;dr In Chrome DevTools in the Elements tab or in Firefox in the Inspector tab you can right click...

...a simple change. Note that Devise's default configuration actually only redirects requests for HTML content (as requested by the HTTP Accept header). For all other formats (like JSON) it...

...config.http_authenticatable = true config.navigational_formats = [] You may want to also disable routes to the HTML forms in your routes.rb: devise_for :users, skip: [:sessions] # or skip: :all to also disable...

Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "&lt;élan&gt;" coder.encode(string, :named) # => "&lt;&eacute;lan&gt;" coder.encode(string, :decimal...

coder.encode(string, :hexadecimal) # => "&#x3c;&#xe9;lan&#x3e;" Decoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "&eacute;lan" coder.decode(string) # => "élan...

If you are using Angular and want something like Rails' simple_format which HTML-formats a plain-text input into paragraphs and line breaks, this directive is for you.

...HTML fragments inside that text will still be escaped properly. Use it like this, where your text attribute specifies something available in your current scope: This is the directive, in...

...partials to call yield. You can use this to extract common containers in your HTML. # _card.html.erb <%= yield %> # index.html.erb <%= render partial: 'card' do %> This is card content <% end %> Using yielding partials...

...Partials vs. Helpers I recommend to avoid using helpers when rendering large chunks of html and go for a partial instead. If your helper method requires a large chunk of...

...xml = Nokogiri::XML(" foo bar ") parses an xml string. You can also call Nokogiri::HTML to be more liberal about accepting invalid XML. xml / 'list item' returns all matching nodes...

If you want to convert a README.rdoc file to HTML, say this from a shell: rdoc README.rdoc You will find the generated HTML in doc/index.html. If you do this while...

...of our gems, please .gitignore everything in doc and don't commit the generated HTML...

...using ASCII art, but you can also make it send those notification as simple HTML e-mails that have some simple formatting for clarity, but no images etc. To do...

...so, activate this option: :email_format => :html Those HTML notifications are still delivered with a text-only version, so if you are using a console client or want to forward...

If you need to test some HTML, e.g. an embed code, you can use RubyMine's "scratch files": File > New Scratch File (or Ctrl + Shift + Alt + Ins) Select "HTML" as...

Write or paste the HTML Move your mouse to the upper right corner of the scratch file editor. Pick a browser to instantly open your file...

...support for passing a block (which could e.g. render a "read on" link), and html_safe knowledge. Prefer the truncate() helper Warning: truncate() calls html_safe if you're not...

...escaping. FWIW, an HTML string may easily become invalid when truncated, e.g. when a closing tag gets chopped off. However, when the input string is "fully html safe", i.e. contains...

...When you append a String to a SafeBuffer (by calling + or <<), that other String is HTML-escaped before it is appended to the SafeBuffer: " ".html_safe + " " # => " &lt;bar&gt;"

...your views to it. This means that any <%= expression %> in your view template will be HTML-escaped, unless the expression returns a SafeBuffer, which does not need to be escaped...

lambda { webrat.current_scope.send(:locate_field, name) }.should raise_error(Webrat::NotFoundError) end Find html content Then /^I should see "([^\"]*)" in the HTML$/ do |text| response.body.should include(text) end

...I should not see "([^\"]*)" in the HTML$/ do |text| response.body.should_not include(text) end Find html content within a selector Then /^I should see "([^\"]*)" in the HTML within "([^\"]*)"$/ do |text...

If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in a controller spec like this: describe UsersController do describe '#index...

github.com

...most Rails application layouts insert randomly rotating CSRF tokens and CSP nonces into the HTML, two requests for the same content and user will never produce the same response bytes...

Tooltips that are delivered through HTML attributes are encoded. Decode entities before checking for their presence. Capybara: Then /^there should( not)? be a(n encoded)? tooltip "([^"]*)"$/ do |negate, encoded, tooltip...

...tooltip = HTMLEntities.new.encode(tooltip) if encoded Then "I should#{negate} see \"#{tooltip}\" in the HTML" end Note This step uses the htmlentities gem described in another card. Make sure you require...

Nobody needs HTML e-mails. However, you occasionally might have to write an HTML message for some weird reason. Here is how: Hold the Shift-Key while clicking on "Write...

github.com

...page to visitors. Disables your application's web interface by writing a #{maintenance_basename}.html file to each web server. By default, the maintenance page will just say the site...

cap maintenance:disable Makes the application web-accessible again. Removes the #{maintenance_basename}.html page generated by maintenance:disable, which will make your application web-accessible again.

...you click on is not necessarily a link or button, but could be any HTML element with a Javascript event binding. The easiest way to get this step is to...

By default Middleman generates files with a .html extension. Because of this all your URLs end in /foo.html instead of /foo, which looks a bit old school. To get prettier...

...slash), then the browser makes a second request to /foo/ to retrieve the actual HTML. You can probably fix this by configuring your static web server. What we want is...

If you're using the :header_html option in PDFKit (or the corresponding --header-html option in wkhtmltopdf), and the header remains invisible, you need to add this to your...

The same applies to footers via footer_html

blog.mailgun.com

Styling HTML email is painful. Tables, inline CSS, unsupported CSS, desktop clients, web clients, mobile clients, various devices, various providers. All these things have to be thought about and tested...

github.com

...und dein Nebensatz." >> " und mein Nebensatz."} Formatting Standard formatting is :ascii. You also have :html and :color formatting: diff = Differ.diff "foo", "boo" puts diff.format_as :html # => boo foo puts diff.format...

superuser.com

Inspecting the source of an email does not always reveal the plain HTML source, but some encoded byte mess. In order to inspect the HTML anyways, you can use a...

While composing a message, select all (Ctrl + A), then navigate to Insert > HTML on the message window. If you need to inspect a received message, hit "Reply" to...