This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test| # Kill rails server and guard | |
| bin/spring stop | |
| brew services stop mysql | |
| brew uninstall mysql | |
| brew install mysql@5.5 | |
| brew link mysql@5.5 --force | |
| brew services start mysql@5.5 | |
| rbenv uninstall 2.3.3 | |
| rbenv install 2.3.3 | |
| gem install bundle |
This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test| module Arel::Predications | |
| def any(right) | |
| Arel::Nodes::Any.new(self, quoted_node(right)) | |
| end | |
| end | |
| class Arel::Nodes::Any < Arel::Nodes::Binary | |
| def operator | |
| :'ANY' | |
| end |
| # app/config/initializers/arel.rb | |
| require 'arel/nodes/binary' | |
| require 'arel/predications' | |
| require 'arel/visitors/postgresql' | |
| module Arel | |
| class Nodes::ContainsArray < Arel::Nodes::Binary | |
| def operator | |
| :"@>" |
I've been doing some work lately with JSON documents in PostgreSQL using jsonb columns. You can query these documents
using a GIN index in PG, but the syntax can be a little cumbersome
SELECT "events".* FROM "events" WHERE "events"."body" @> '{"shift":{"user_id":2}}'You have to construct the right side of the query as a JSON string, which is a bit annoying. So I wondered if I could adapt Arel to do the tedious stuff for me.
| module Commands | |
| module Meeting | |
| AcceptSchema = Dry::Validation.Schema do | |
| required(:user_id).filled | |
| required(:status).value(eql?: :scheduled) | |
| end | |
| class Accept < Command | |
| def call | |
| return validate if validate.failure? |
http://www.oreilly.com/programming/free/files/microservices-for-java-developers.pdf
http://www.oreilly.com/programming/free/files/microservices-for-java-developers.epub
http://www.oreilly.com/programming/free/files/microservices-for-java-developers.mobi
http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.pdf
http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.epub
http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.mobi
| // 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
| const axios = require('axios'); // promised based requests - like fetch() | |
| function getCoffee() { | |
| return new Promise(resolve => { | |
| setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
| }); | |
| } |
| git branch | wc -l |