I hereby claim:
- I am calopez on github.
- I am karloslopez (https://keybase.io/karloslopez) on keybase.
- I have a public key ASAgUhfQW56OTgbSiCtz4tBVkUyGxO2ErCmbjpoQL-d7JQo
To claim this, I am signing this object:
# 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") |
I hereby claim:
To claim this, I am signing this object:
-- 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 |
%% Based on code from | |
%% Erlang Programming | |
%% Francecso Cesarini and Simon Thompson | |
%% O'Reilly, 2008 | |
%% http://oreilly.com/catalog/9780596518189/ | |
%% http://www.erlangprogramming.org/ | |
%% (c) Francesco Cesarini and Simon Thompson | |
-module(frequency). | |
-export([start/0,allocate/0,deallocate/1,stop/0]). |
%% Based on code from | |
%% Erlang Programming | |
%% Francecso Cesarini and Simon Thompson | |
%% O'Reilly, 2008 | |
%% http://oreilly.com/catalog/9780596518189/ | |
%% http://www.erlangprogramming.org/ | |
%% (c) Francesco Cesarini and Simon Thompson | |
-module(frequency). | |
-export([init/0]). |
-module(palin). | |
-export([ | |
palin/1, | |
nopunct/1, | |
palindrome/1, | |
client/0, | |
server/0 | |
]). | |
% palindrome problem |
-module(sort). | |
-export([qsort/1, test/0]). | |
-include_lib("eunit/include/eunit.hrl"). | |
qsort([]) -> []; | |
qsort([X1|Xs]) -> qsort(Xs, X1). | |
qsort(L, Pivot) -> qsort(left(L, Pivot)) ++ [Pivot] ++ qsort(right(L, Pivot)). | |
right(L, Pivot) -> [X || X <- L, X > Pivot]. |
-module(hof). | |
-export([ | |
compose/1, | |
iterate/1, | |
twice/1, | |
test/0 | |
]). | |
-include_lib("eunit/include/eunit.hrl"). | |
compose([Fi|Fs]) -> fun(Arg) -> Fi(compose(Fs, Arg)) end. |