Close a frozen ssh session
Public

Properly close a frozen ssh session

How to add images (i.e. logo) to email messages while using Pony gem.
Public

Pony gem allows to easily send good looking and customizable emails, but it doesn't provide a way to include image in a way that it will be displayed in gma...

How to use helper methods in mailer templates
Public

How to use helper methods in mailer templates? Instead of this "include YourHelper" use this "add_template_helper YourHelper" in YourMailer

How to set maximum backup size in time machine
Public

To set maximum backup size run this command in shell...

How to deal with RSpec time precision error
Public

In some cases, Ruby uses higher precision to represent time than the DB. When we compare a timestamp before and after saving to the DB it might not be equal.

How to detect time-overlapping-records in Postgres + Rails
Public

```ruby Model .where("TSRANGE(?, ?, '()') && TSRANGE(starts_at, ends_at, '()')", starts_at, ends_at) .where.not(id: record_id) .exists? ``` Bot...

Fix openssl error (macOS, ruby 2.3)
Public

So, you're trying to setup an Ruby 2.3.X-powered Rails app and it complains about openssl? Using a Mac? You're not the first. I've also been there. Let's get this nasty bug out of your way!

Flush dns in macOS
Public

``` sudo killall -HUP mDNSResponder ```

How to restore deleted git branch
Public

Short and working solution to restore deleted git branch

Move last commit to a feature branch
Public

When you accidentally commit to master/staging and need to move the commit to a feature branch

How to include logo into devise messages
Public

A quick guide how to include any file, in this case logo to devise messages

De Morgan's laws in Ruby
Public

The negation of a disjunction is the conjunction of the negations and The negation of a conjunction is the disjunction of the negations.

Rails ERD diagram visualisation online
Public

Manual: 1. Go to https://dbdiagram.io/d 2. Click *import* and choose *Import from Rails (schema.rb)* 3. Paste schema.rb content 4. voilĂ 

https://dbdiagram.io/d

Using comment notes in Rails
Public

In your code: ```ruby # TODO: fix this ``` In your shell: ```bash % rake notes ``` ```text config/routes.rb: * [ 1] [TODO] fix this ```

Set the same password for all users in one query
Public

Reset devise passwords quickly, even for thousands of users.

Amazing js library to manipulate rendered table - Tabulator.js
Public

Need filters, remote paginations, search field in table, selecting row and much more ... You will find everything in this library

http://tabulator.info/

Puppeteer - good library for generating pdf's from html.
Public

Puppeteer is node library providing high level chromium api. One of it's key features is generating pdf from html using chromium web engine. This is great ad...

https://github.com/GoogleChrome/puppeteer

Fix bundler error "can't find gem bundler (>= 0.a) with executable bundle"
Public

This error message seems to be related to network or Bundler issue, but it isn't - newer version of Bundler requires new version of RubyGems, which is not updated by default. Here, you'll see how to fix this issue.

jsPDF - JavaScript library for generating PDFs without using backend
Public

Sometimes you wonder if there's a way to generate PDF without dealing with wk*topdf, puppeteer and other massive serverside tools - and there's one - jsPDF - which will generate a PDF for you in a moment, all client-side!

http://raw.githack.com/MrRio/jsPDF/master/

Rubular - a Ruby regular expressions editor
Public

Rubular is an online tool to check regular expressions written in Ruby.

http://rubular.com/

How to simplify nested ifs
Public

If you have `if`s nested in this way: ``` if a if b 1 else 2 end else 3 end ``` You can flatten and simplify them into this: ...