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

snippets.dzone.com

These two models can be used to access the posts and associated comments of a WordPress database.

makandra dev

If you modified git's history and the change was already pushed, you will usually get a ! [rejected] my-branch...

To change the commit message of the latest (unpushed, unmerged) commit, you can use git commit --amend

Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but...

makandra dev

Lets say you need to make a change to a commit OLD_COMMIT, but this is not the most recent...

You can get YAML.load to instantiate any Ruby object by embedding the desired class name into the YAML code. E.g...

If your controller spec never reaches your controller code: Make sure you are signed in. Make sure you are actually...

Use the Launchy gem: Launchy.open('http://www.ruby-lang.org/')

tug.dk

Gallery of fonts you can use without much hassle in LaTeX. The license of the fonts vary, but are all...

apidock.com

To temporarily change the current working directory in Ruby, call Dir.chdir with a block. The previous working directory will be...

yehudakatz.com

The first thing you need to understand is that the purpose of refinements in Ruby 2.0 is to make monkey...

If you need to do calculations inside the database and can not use Ruby objects you may run into problems...

When a has_many association basically serves to store a list of associated strings (tags, categories, ...), it can be convenient...

This card explains how to install RubyMine for the first time. If you want to upgrade an existing RubyMine installation...

avdi.org

When rendering a partial with the :collection option, you are automatically provided with a counter variable inside the partial template...

nokogiri.org

Because Nokogiri needs to be compiled and dynamically linked against both libxml2 and libxslt, it has gained a reputation for...

When you just went through a long debug-fest and infested your code with dozens of debug messages, it can...

Have you guys ever done the math on that? You asked or allowed for 24000 interruptions from literally every human...

Note that this card is very old. You might want to use ActiveType for your auto-coerced virtual attributes instead...

Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.

apidock.com

E.g. when you're using a tagging gem, you have seen virtual attributes that get and set a string array...

makandra dev

In order to go back one page in your Cucumber tests, you can use the following step definition for Capybara...

robots.thoughtbot.com

Selenium has been the siren song that continually calls out to us. Unfortunately, in practice we’ve been unable to...