When using ORDER BY "column" in PostgreSQL, NULL values will come last. When using ORDER BY "column" DESC, NULLs will...
There is no such thing as a "default order" of rows in database tables. For instance, when you paginate a...
If you're a frequent user of LibreOffice, I strongly recommend to checkout out the VLOOKUP function (SVERWEIS in German...
Small (1.5 KB) Javascript library that lets you render tables, lists, etc. with hundreds of thousands of items.
Re-creating a complex ActiveRecord scenario quickly without setting up a full-blown Rails app can come in handy e.g...
When you want to UPDATE a table with information from an associated table, you can JOIN the associated table into...
Several Rails migration methods accept index: true as an option to create an index. In some cases (like #add_column...
TL;DR Under certain circumstances, dynamically defined symbols may break keyword arguments in Ruby 2.2. This was fixed in Ruby...
You know that ActiveRecord caches associations so they are not loaded twice for the same object. You also know that...
Instead of this: Image.order('images.created_at DESC') You can write this: Image.order(created_at: :desc) Not only do you not...
It's generally not trivial to change a datetime's seconds, minutes, etc in SQL. Here is how it works...
Web applications can be used by multiple users at the same time. A typical application server like Passenger has multiple...
Clever hack using data-attributes to assign labels to cells. It's still a massive duplication of code (labels), but...
See this Railscast. Basically you can simply write views like index.xlsx.erb: ID Name Release Date Price <% @products.each do |product| %> <%= product.id...
SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'your_database' order by table_rows;
Good article about window functions. Also note how they use a postgres feature called common table expressions.
The linked article explains how to get a database-wide lock without creating table rows: This article explains how I...
TL;DR Block formatting contexts establish an isolating container. float and clear only apply to elements within such a container...
Right-click on the table Select Table... Select Text flow Uncheck Allow row to break across pages and columns
If you want to load an SQL dump from an ActiveRecord migration, you might find this to be harder than...
Geordi 1.0 features a command line application geordi, that holds most of Geordi's previous commands. New features
Add gem 'database_cleaner' to your Gemfile. Then: Cucumber & Rails 3+ # features/support/database_cleaner.rb DatabaseCleaner.clean_with(:deletion) # clean once, now DatabaseCleaner.strategy = :transaction...
Sequel is an awesome ORM such as ActiveRecord. The linked article describes how easily you can implement and use materialized...
In the tradition of our PostgreSQL cheat sheet for MySQL lamers, here is a cheat sheet for Jasmine when you...