Tuesday, January 29, 2019

Rails - ActiveRecord related


Whistle - a web framework based on Elixir

https://github.com/boudra/whistle

What problems does Whistle address?

Whistle is a web framework that works a bit differently than normal MVC web frameworks. It is composed of stateful long-running components, allowing you to create interactive applications entirely in Elixir via WebSockets, while being also able to render an HTML page like any other web framework.
It aims to provide a more functional approach to building web apps in Elixir, while also taking more advantage of Erlang's actor model.
It also provides an extensive Javascript API for when Elixir alone doesn't cut it and interop with existing front-end libraries like React is needed.

tail + grep (multiple patterns)

https://stackoverflow.com/questions/23395665/tail-f-grep
https://unix.stackexchange.com/questions/37313/how-do-i-grep-for-multiple-patterns-with-pattern-having-a-pipe-character
https://stackoverflow.com/questions/7161821/how-to-grep-a-continuous-stream/7162898#7162898

Example: To grep for "Processing by" & "Parameters:" -
tail -f log/development.log | grep -E "Processing by|Parameters:"

Output:
2019-01-06 14:24:20.030 [INFO ] [30600:1788] Processing by Spree::ProductsController#index as JS

2019-01-06 14:24:20.031 [INFO ] [30600:1788]   Parameters: {"sort_scope"=>"default", "page"=>"12", "infiniteScroll"=>"true"}