Code snippet tested with Rails 2.3 def index # ... if request.xhr? html = render_to_string(:partial => "list", :layout => false) respond_to...

This actually works: class Klass def initialize `hi world` end def `(message) puts "Called with backticks: #{message}" end end

plugins.jquery.com

SudoSlider is a simple yet powerful content slider that makes no (or very few) assumptions about your markup and is...

When you have a string containing umlauts which don't behave as expected (are not matched with a regexp, can...

mupdf.com

MuPDF is a PDF reader that renders very quickly, yet still correctly. It supports PDF 1.7 and all the fancy...

So you want your Ruby script to install missing gems instead of dying? Take this method: def installing_missing_gems...

When your Rails controller action responds with only a simple text, render text: 'Hello' may not be what you want...

I use this to simulate the (non-existing) :last-letter CSS pseudoclass, e. g. to insert a tombstone at the...

Since version 34, Chromium/Chrome ignores the autocomplete="off" attribute on forms or input fields. Recent versions of other browser do...

The error unexpected 'x' after 'DESCENDANT_SELECTOR' (Nokogiri::CSS::SyntaxError) (where x may be basically any character) occurs when the...

makandra dev
menuetos.net

MenuetOS is an Operating System in development for the PC written entirely in 32/64 bit assembly language. Menuet64 is released...

Programatically invoke Rails generators Require the generator, instantiate it and invoke it (because generators are Thor::Groups, you need...

docopt.org

docopt helps you define interface for your command-line app, and automatically generate parser for it. docopt is based on...

If you regularly get ActionView::MissingTemplate exceptions, maybe some bot visits your site requesting silly formats like: http://www.rails-app.com/makandra.html-username-2000...

If you are using Angular and want something like Rails' simple_format which HTML-formats a plain-text input into...

linux.die.net

Sometimes you may want to print files from the command line, especially when you have lots of them.

wiki.macromates.com

When using TextMate2 with the cucumber bundle, it does not recognize step definitions (e.g. custom_steps.rb) as such but believes they...

makandra dev
sitepoint.com

A look at Prawn, PDFKit, and Wicked PDF

blog.codeclimate.com

Splitting a long method into sub methods is easier in instances since it is in classes. Since...

lucaguidi.com

Ruby’s model for concurrency is based on threads. It was typical approach for object oriented languages, designed in the...

If you are trying to inspect timings in JavaScript, you can use console.time and console.timeEnd which will write to your...

When you call a method on an object, Ruby looks for the implementation of that method. It looks in the...

makandra dev

To print a colored full-width bar on the bash, use this bash script expression: echo -e '\033[37;44m...

makandra dev

Just found out about a great feature in Rails that seems to be around since Rails 2. Start a console...