Skip to content

Instantly share code, notes, and snippets.

View Dimaon's full-sized avatar

Dmitriy Kulikov Dimaon

View GitHub Profile
@Dimaon
Dimaon / rails-jsonb-queries
Created February 16, 2021 10:37 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
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")
@Dimaon
Dimaon / BootstrapToRails6.md
Created February 13, 2021 14:10 — forked from nachozt/BootstrapToRails6.md
Bootstrap to Rails 6 with webpacker

Step 1:

Add bootstrap and its dependencies:

yarn add bootstrap jquery popper.js

Step 2:

in config/webpack/environment.js add the following:

@Dimaon
Dimaon / sidekiq.service
Last active June 5, 2019 08:32 — forked from mkhuda/sidekiq.service
Sidekiq service auto start for Ubuntu 16.04 using Systemd
#
# Sidekiq auto start using systemd unit file for Ubuntu 16.04
#
# Put this in /lib/systemd/system (Ubuntu).
# Run:
# 1. systemctl enable sidekiq (to enable sidekiq service)
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service)
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).