Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| # frozen_string_literal: true | |
| module Tesseract | |
| module Transaction | |
| module Steps | |
| # Executes the step in a background job. Argument is either an ActiveJob | |
| # or another Transaction (or anything that implements `#perform_later`. | |
| # | |
| # If the provided transaction implements a `validate` step, then that | |
| # validator will be called on the input before the job is enqueued. This |
| http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
| http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
| #payload: [{"kind"=>"person"}] | |
| Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
| #data: {"interest"=>["music", "movies", "programming"]} | |
| Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
| Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
| Segment.where("jsonb_array_length(data->'interest') > 1") |
| -- Retrieve descendants | |
| -- ==================== | |
| -- retrieve descendants of #4 | |
| SELECT c.* | |
| FROM Comments AS c | |
| JOIN TreePaths AS t ON c.comment_id = t.descendant | |
| WHERE t.ancestor = 4; | |
| -- Retrieve ancestors |
| After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
| The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
| Database files have to be updated before starting the server, here are the steps that had to be followed: | |
| # need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
| brew unlink postgresql | |
| brew install postgresql@9.6 | |
| brew unlink postgresql@9.6 | |
| brew link postgresql |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| Env config files. |
| # Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
| # that enables you to choose a character from a menu of options. If you are on Lion | |
| # try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
| # for input. | |
| # | |
| # It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
| # it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
| # as it means you cannot press and hold h/j/k/l to move through your file. You have | |
| # to repeatedly press the keys to navigate. |