After updating Rubygems you see a wall of deprecation warnings like this: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after...

...Gem::SourceIndex#add_spec called from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:197. NOTE: Gem::SourceIndex#add_specs is deprecated with no replacement. It will be removed on or after 2011-11-01. Gem::SourceIndex...

github.com

FactoryBot allows a :class option to its factory definitions, to set the class to construct. However, this option is not supported for traits. Most often, you can just define a...

If you need/want to use traits instead (for example, it might make more sense semantically), you can not use a :class on a trait. In that case, use initialize...

mupdf.com

MuPDF is a PDF reader that renders very quickly, yet still correctly. It supports PDF 1.7 and all the fancy shenanigans that evince (Ubuntu's default PDF reader) fails to...

...render properly. On Ubuntu, MuPDF is available in the Universe sources. Simply install via APT: sudo apt-get install mupdf Interaction primarily happens via keyboard, but there is basic mouse...

If you worked with a system Ruby before switching to RVM, this system Ruby will be in your way when you switch between projects with/without RVM.

...get rid of your system Ruby entirely, but you can tell RVM to just use a given Ruby by default, e.g.: rvm --default use 1.8.7 You need to re-open...

...helpful when you need the latest file inside a directory for processing in a shell script: ls -1tr * | tail -1 Used switches The -1 switch makes ls return...

...file per line, -t orders by modification time and -r causes sorting from oldest to newest. tail -1 then returns the last line, containing the newest file's name.

...Thunderbird for easier access and less trouble when trying to find out who to send a message to. Here is how to do this: Open your Thunderbird address book

...list and add contacts. There will be auto completion from your address book. When sending e-mails you can now add a recipient with the mailing list's name and...

makandra dev
github.com

Katapult 0.3.0 brings Rails 5 and Ruby 2.5 support with a new design, plus a ton of smaller features, fixes and improvements. Features Generating a Rails 5.1.4 app on Ruby...

...Dropped asset pipeline in favor of Webpacker The generated application now has a sleek, simple design based on Bootstrap Employing Unpoly New application model DSL shortcut crud for "create a...

...not investigate in the 2342 tools that exist for migrating IMAP accounts from one server to another. They all suck. Try your luck with imapsync. We have no clue why...

...the guys suggest buying the script on their site, maybe they missed removing that part after this April fool's trick. Go to https://fedorahosted.org/released/imapsync/ and get the sources...

...may want to know the current commit. [1]\ Luckily, there is lots of useful stuff in the .git directory. Commit hash that you are currently applying cat .git/rebase-merge/stopped-sha

...you want to inspect the original commit for its changes, for example like: git show `cat .git/rebase-merge/stopped-sha` Current commit's message cat .git/rebase-merge/message In case you forgot what the changes...

Simply use OpenStruct#to_h to receive an OpenStruct's hash representation. In older Rubies you need OpenStruct#marshal_dump instead. Ruby 2.0+ >> OpenStruct.new(foo: 23, bar: 42).to_h...

...table, MySQL needs to know which table you want to delete from. Let's say that Post belongs_to :author. In order to delete all posts from the author named...

github.com

...handling file uploads in Rails. It handles direct uploads (also direct uploads to Amazon S3) better than Carrierwave. The story and reasoning behind some of the decisions in Refile, and...

...a good read before deciding which way you'll go. Big Caveat: Refile only stores the original image and renders the desired version (e.g. smaller, cropped) on page load. This...

...31m\]$(__git_ps1 "(%s)") \[\033[01;34m\]$\[\033[00m\] ' Reload the changes by saying source ~/.bashrc For some customized prompts that also show the current Git prompt, see the examples...

...section at the bottom of our bash prompt customizing card...

Copy the .vdi drive data into the new machine folder In the machine settings, add that .vdi as a hard drive, and remove the dummy .vdi you created when...

...and illformed requirements, it is most probably an error resulting from the transition from Syck to psych. To fix this: go to your gemspec directory (e.g. /Library/Ruby/Gems/1.8/specifications/) change # to = (equals...

...sign) in each file that's complaining

In a Rails application, *_spec.rb files get special treatment depending on the file's directory. E.g. when you put a spec in spec/controllers your examples will have some magic context...

...get that appears out of nowhere. If you want that magic context for a spec in another folder, use the :type option: describe CakesController, :type => :controller do ...

makandra dev
rakeroutes.com

...Rails (e.g. for the Rails console) .irbrc_rails defines efind(email), which is a shortcut to find users by email requires hirb, if present set the prompt to your Rails...

chartjs.org

Chart.js seems to be a good alternative to Google's Chart API and other commercial chart drawing libraries. good looking charts canvas based (means less memory consumptive, but no interactivity...

highly configurable good API and documentation just 4.5 kilobytes MIT license Browser support: all browsers supporting the canvas element (for IE8 and below, use the polyfill as describes...

stackoverflow.com

...you ever opened a file with vim, edited it and when you wanted to save your changes it told you "Can't open file for writing", because you opened it...

...without sudo? There's an easy hack to let you write it anyway: :w !sudo tee % The linked SO post explains in detail what will happen. Create a shortcut

The following Sass will do the trick: button, input[type="reset"], input[type="button"], input[type="submit"], input[type="file"] > input[type="button"] &::-moz-focus-inner border: none

stackoverflow.com

...the with_routing helper -- but that one destroys existing routes which may break a specs that require them to work. To keep both "regular" and test routes, do this:

...MyApplicationController < ActionController::Base def show render text: 'Welcome to my application' end end test_routes = Proc.new do get '/my_application' => 'my_application#show' end Rails.application.routes.eval_block(test_routes)

It's like a GUI for the famous git add [-p]. Select files with the up/down-keys and hit u for staging/unstaging the whole file Enter for showing the diff of...

j and k to navigate in the diff u again to stage/unstage chunks 1 to stage/unstage only lines \ to split large chunks F5 to refresh the view

web.archive.org

With its you can switch the subject of an example to a method value of the current subject: describe Array do its(:length) { should == 0 } end stub_chain is the...

...tie to go along with should_receive_chain's tux: object.stub_chain(:first, :second, :third).and_return(:this) You can restore the original implementation of stubbed methods with unstub:

...false, you need to do it like this: nil.should == false # fails as expected Wat? See also RSpec: be_true does not actually check if a value is true