class Document < ActiveRecord::Base scope :any_tags, -> (tags){ where('tags && ARRAY[?]', tags) } scope :all_tags, -> (tags){ where('tags @> ARRAY...

ankane.github.io

Create beautiful Javascript charts with one line of Ruby. Promising chart library for easily rendering charts with Google Charts.

tl;dr: Use with_index ActiveRecord's find_each with index If you do not provide a block to find...

Have you tried the Search everywhere dialog? You can open it by pressing Shift twice.

engineyard.com

Nice tutorial about packaging Ruby bindings to your API in a Ruby gem, with tests using VCR casettes.

api.rubyonrails.org

To avoid n+1 queries, you want to eager-load associated records if you know you need to access them...

Cookies without an expiration timestamp are called "session cookies". [1] They should only be kept until the end of the...

There are different ways to run rake: On Rails 4.1+ projects, you have Spring and its binstubs which dramatically improve...

In Rails, you can very easily send emails with HTML and plaintext bodies. However, if you're trying to debug...

ruby.about.com

The flip-flop operator is a hotly contested feature of Ruby. It's still struggling to find an idiomatic use...

We will be installing rbenv and ruby-build from our own fork, not from the Ubuntu sources. Installing rbenv

Let's say you have two screens: Show a given project Show a report for all projects Ideally you want...

Sometimes you need complex expectations on method arguments like this SomeApi.should_receive(:find).with(:query => '*foo*', :sort => 'timestamp ASC', :limit...

github.com

PDFKit converts a web page to a PDF document. It uses a Webkit engine under the hood...

stackoverflow.com

If you want to move an element inside an array, neither JavaScript/ES6+ nor libraries like LoDash offet that natively.

Yesterday, Rails fixed a security issue (CVE-2014-3514) in Rails 4+. It was possible to use .where...

Nearly all jQuery traversal functions ignore elements that are not HTML tags. To work with other type of nodes (like...

Microsoft Exchange service administrators can enable Exchange Web Services (EWS) which is a rather accessible XML API for interacting with...

ozmm.org

require 'net/http' module Cheat extend self # the magic ingredient def host @host ||= 'http://cheat.errtheblog.com/' end def http @http ||= Net...

makandra dev
github.com

edge_rider is Power tools for ActiveRecord relations (scopes). Please note that some of the functions edge_rider provides have...

When you have an Angular directive that transcludes content, you might want to do something in case there is no...

makandra dev
feedjira.com

Great gem to consume RSS feeds. I was missing some features on Ruby's RSS::Parser that I found in...

You know each_with_index from arrays: ['hello', 'universe'].each_with_index do |value, index| puts "#{index}: #{value}" end

So you have placed a breakpoint somewhere and now want to dig around, but not even inspecting variables is working...