makandra dev
github.com

...major browsers since 2022. Since images are magnitudes larger in file size than text (HTML, CSS, Javascript) is, loading the images of a large web page takes a significant amount...

...of image tags from the browser with JS. This way, no modification of the HTML would be necessary and the whole lazy-loading could be accomplished by javascript. However, this...

...strong parameters? (now part of Rails) How does Rails protect you against injecting unwanted HTML tags? How to prevent users from uploading malicious content? How do we organize our application...

...an attacker with bad intentions. Exercise: XSS in Rails Intentionally make MovieDB vulnerable to HTML code injection Boot up a second Rails application on another port (e.g. rails server -p...

...styles incorrectly. As a reminder, this will disallow inline styles you set in your html inline styles set by JS libraries using element.style = 'display: none;' What will keep working is...

...the multipart option like this in very old versions of Rails: form_for @invoice, :html => { :multipart => true } do If you do not, Rails will only receive the file name...

You have uncommited changes (you can always check by using git status), which you want to discard.

If you need to implement newsletter sending, rapidmail is a solid option. Support is very fast, friendly and helpful, and...

Let's say you want to find the element with the text hello in the following DOM tree: hello

Our applications not only need to be functional, they need to be fast. But, to quote Donald Knuth, premature optimization...

...agreed on a common format to do this: OpenGraph tags that go into your HTML's : Note The property og:image must be a full URL. It cannot be a...

makandra dev
github.com

...and footer files, add or modify these attributes in your PDFKit options hash: { header_html: 'app/views/foo/bar/header.html', footer_html: 'app/views/foo/bar/footer.html', margin_top: '200px', # Height of the header, can be px or...

...that parse data correctly, like the parser gem for Ruby code or Nokogiri for HTML. Regular expressions are a blunt tool that happens to be good enough much of the...

...time. Read Parsing Html The Cthulhu Way for more...

...sites with their documentation, e.g.: http://unpoly.com https://lodash.com/ https://fontawesome.com/icons Web Platform (HTML, JavaScript, CSS) The best reference to look up information on HTML tags, JavaScript features or...

github.com

...that supports it (e.g. Selenium, not the default Rack::Test driver). Consider the following HTML: One Two With some CSS: .test1 { display: block } .test2 { display: none } We will be using...

...it inline within the browser window. You can do so with either the [download] HTML attribute, or by sending a Content-Disposition header when delivering the image. When editing a...

...sees an image review, downloads image. Capybara needs the browser to show an interactive HTML page to be happy. Capybara methods will fail when the browser shows a "Save as...

...t need a Rails project for this. Just make a new folder with static HTML and CSS files. You can push it into a new repository in GitLab.

...peak too much into the actual HTML and CSS of makandracards.com. You are likely to have trouble deciding where to draw the line between the blocks. E.g. a structure could...

...Rack::MiniProfiler.config.skip_paths = [ # ignore most asset requests %r(/system.*), %r(/assets.*), ] Rack::MiniProfiler.config.html_container = 'html' # avoid unpoly replacements end end SQL Rack-Mini-Profiler will give you a lot of...

makandra dev

RubyMine has a HTTP Client that can be useful to test web APIs. Just create a .http scratch file an...

haml.info

Haml renders HTML with indentation reflecting the nesting level of elements. When it comes to white-space preserving content, this may become a problem: the content will be rendered including...

...the HTML indentation. Problematic: Preserved Indentation .nest %span Reference %pre = content Reference Hello World Better: Without Extra Indentation Render with tilde ~ instead of equals = to keep Haml from indenting content...

...routes to use the same constraint you can use the block syntax: constraints(format: 'html') do resources :pages resources :images end If you want constraints only on certain routes, you...

get '/users/account' => 'users#account', constraints: { format: 'html' } Tip You can also avoid this error type through format constraints in your controllers and use correct file names...

...validations which could be used to give fields that have a presence validation the HTML required attribute. We usually turn it off due to difficulties controlling its behavior and appearance...

module Components module AriaRequired def aria_required(_wrapper_options) if required_field? input_html_options['aria-required'] = 'true' end nil end end end end SimpleForm::Inputs::Base.include(SimpleForm::Components...

...will have a hard time using your page. ✔️ Better solution: Use a fitting native HTML element Do not use the hacks above. Instead, use the HTML element which was meant...

...pev2, a handy tool for analyzing execution plans. You can download the attached standalone HTML file (original source) to use the app offline—simply open the file in your browser...

Partials always define a local variable with the same name as themselves. E.g. when you are in _recent_users.html.erb, a local...

...path or asset_path if you need the raw asset hashed paths without an HTML tag. Whenever you don't pipe an asset path through a Rails helper, you don...