This file contains 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
1. Create command line tool for rumybine https://www.jetbrains.com/help/ruby/working-with-the-ide-features-from-command-line.html#arguments | |
2. Open iterm -> Profiles -> Advanced -> Semantic History -> Run command and past | |
[ -z "\2" ] && /usr/local/bin/mine \1 || /usr/local/bin/mine --line \2 \1 |
This file contains 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
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") |
This file contains 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
module Enumerable | |
def cluster | |
cluster = [] | |
each do |element| | |
cluster.last && cluster.last.last == element ? cluster.last << element : cluster << [element] | |
end | |
cluster | |
end | |
end |
This file contains 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
module Enumerable | |
def cluster | |
cluster = [] | |
each do |element| | |
if cluster.last && cluster.last.last == element | |
cluster.last << element | |
else | |
cluster << [element] | |
end | |
end |