When submitting textareas, browsers sometimes include carriage returns (\r) instead of just line feeds (\n) at the end of each...

makandra dev

There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...

makandra dev

This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...

makandra dev

If you added a file by mistake, you can unstage it (but keep local changes) by saying git reset HEAD...

Rails 3, 4, 5, 6 config/application.rb config/environment.rb before the initialize! call (we don't usually edit this file)

makandra dev

Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.

github.com

There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define

When deploying Rails applications you might have noticed that JS and CSS are not cached by all browsers.

When working with times and dates in Rails applications, you need to deal with the following problem: In Rails, Time...

Use this if you want to show or hide part of a form if certain options are selected or boxes...

The Git stash does not work like a one-slot clipboard and you might shoot yourself in the foot if...

So you screwed up and copied Paperclip secrets from one project to another. Here is a semi-automatic, painful way...

makandra dev

The following counts all the lines in all *.rb files in the app directory. Run several of these commands to...

stackoverflow.com

Reverting a commit means creating a new commit that undoes the old changes. Imagine the following commit history:

The following Sass will do it: hr color: #ddd background-color: #ddd border: none height: 1px

github.com

An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...

Open the configuration file: gksudo gedit /usr/share/vte/termcap/xterm Find a line like this: :co#80:it#8:li#24:\

In a nutshell: to avoid your shell character set from messing with imports, use -r to export and SOURCE when...

ALTER DATABASE database_name CHARACTER SET "utf8"; ALTER DATABASE database_name COLLATE "utf8_unicode_ci"; After that, for...

github.com

Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a...

javascriptcompressor.com

Compress and obfuscate Javascript code online completely free using this compressor.

makandra dev

This may be awkward to set up, but will work once you're done. Fun facts:

Unless all MySQL server defaults are set to UTF-8, mysqldump encodes UTF-8 characters incorrectly and only outputs correct...

Create a branch: svn copy https://dev.makandra.de/svn/filepanic/trunk https://dev.makandra.de/svn/filepanic/branches/$ticketnumber_shortdesc Don't just copy the folder into your working...