05/25/2018: tested with macOS Sierra High 10.12.6
08/04/2020: added @mayesa's suggestion to fix an exception with EventMachine 08/04/2020: tested with macOS Catalina 10.15.5
Install MailCatcher:
brew install ruby
sudo gem install mailcatcher
/* | |
Sorting order preserving base64 implementation. | |
Based on the original implementation of | |
picoweb / litheweb -- a web server and application framework | |
for resource constraint systems. | |
Copyright (C) 2012 - 2018 Wolfgang Draxinger | |
This program is free software; you can redistribute it and/or modify |
[alias] | |
#? = diff | |
a = help | |
ai = init | |
aixas = revert | |
alaks = mv | |
apan = rebase | |
diks = show | |
fer = clone | |
graps = commit |
#!/usr/bin/env ruby | |
# Load Rails | |
ENV['RAILS_ENV'] = ARGV[0] || 'production' | |
DIR = File.dirname(__FILE__) | |
require DIR + '/../config/environment' | |
# ... do stuff that requires using your rails models |
05/25/2018: tested with macOS Sierra High 10.12.6
08/04/2020: added @mayesa's suggestion to fix an exception with EventMachine 08/04/2020: tested with macOS Catalina 10.15.5
Install MailCatcher:
brew install ruby
sudo gem install mailcatcher
It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media
This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.
namespace :optimization do | |
desc "Provide DB vacuum for production environment" | |
task :vacuum => :environment do | |
begin | |
tables = ActiveRecord::Base.connection.tables | |
tables.each do |table| | |
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};") | |
end | |
rescue Exception => exc | |
Rails.logger.error("Database VACUUM error: #{exc.message}") |
[ Update 2020-05-31: I won't be maintaining this page or responding to comments anymore (except for perhaps a few exceptional occasions). ]
Most of the terminal emulators auto-detect when a URL appears onscreen and allow to conveniently open them (e.g. via Ctrl+click or Cmd+click, or the right click menu).
It was, however, not possible until now for arbitrary text to point to URLs, just as on webpages.