Heroku's docs on this are now the definitive source. I just followed their instructions to update my apps and they're much better than they were when I made this gist. Here's the previous revision if you need still need it. Good luck!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in rails application.rb | |
initializer "postgresql.no_default_string_limit" do | |
ActiveSupport.on_load(:active_record) do | |
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:string].delete(:limit) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# As a general rule, I despise all things SEO with it's witchery and voodoo ways. | |
# However, these two practices are confirmed semi-non-witchcraft SEO best practice. | |
# | |
# 1. Serve your content from a consistent domain (www vs. non-www, Doesn't matter. Just be consistent) | |
# In addition this is nice for Heroku and other cloud based deployment environments that leave your app | |
# accessible from a url like http://myapp.herokuapp.com | |
# | |
# 2. Believe it or not, trailing slashes matter. The google machine interprets http://domain.com/about | |
# as a different page than domain.com/about/ | |
# (source: http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.add_selector(:link) do | |
xpath {|rel| ".//a[contains(@rel, '#{rel}')]"} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newpg=9.6.1 # set to new PG version number | |
oldpg=`pg_config --version | cut -d' ' -f2` | |
# PG 96. upgrades the readline to v7, which breaks anything linked against readline v6, like ruby via ruby-build. | |
# I *think* this should prevent it from installing v7. But if weird shit happens with various rubies, | |
# you'll have to reinstall them. | |
brew pin readline | |
# Stop current Postgres server | |
brew services stop postgresql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file: /etc/xdg/lxsession/LXDE/autostart | |
# sudo raspi-config # Enable Boot To Desktop | |
# idea via: http://lokir.wordpress.com/2012/09/16/raspberry-pi-kiosk-mode-with-chromium/ | |
@lxpanel --profile LXDE | |
@pcmanfm --desktop --profile LXDE | |
# @xscreensaver -no-splash | |
@xset s off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH table_scans as ( | |
SELECT relid, | |
tables.idx_scan + tables.seq_scan as all_scans, | |
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
pg_relation_size(relid) as table_size | |
FROM pg_stat_user_tables as tables | |
), | |
all_writes as ( | |
SELECT sum(writes) as total_writes | |
FROM table_scans |
When dealing with legacy data it's been pretty common to run into malformed / illegal byte sequences in files. Figuring out what's causing the issue is often really difficult, especially when the file has thousands of rows.
Here's a trick I pretty much stumpbled upon:
nl file.txt | sort
sort: string comparison failed: Illegal byte sequence
sort: Set LC_ALL='C' to work around the problem.
When running specs I often see this output before the specs start to run.
> rspec spec
Time: 0.288 ms
Time: 0.110 ms
Time: 0.084 ms
Time: 0.095 ms
Time: 0.105 ms
Time: 0.115 ms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# A Ruby HTTP Client Library | |
# https://github.com/jnunemaker/httparty | |
require 'httparty' | |
## | |
# "Getting Started" ServeManager API Client | |
# | |
# Our API is accessible from any language, of course. Hopefully a concrete | |
# working code example helps you get the basics built in the language of your |
OlderNewer