Thursday, February 7, 2019
Wednesday, February 6, 2019
Friday, February 1, 2019
Thursday, January 31, 2019
Wednesday, January 30, 2019
Tuesday, January 29, 2019
Rails - ActiveRecord related
Here's jpegs, because Twitter uses a white background to preview PNGs in the timeline but a black one in the individual photo view. pic.twitter.com/dWSz6wCSx7— Nate Berkopec (@nateberkopec) January 11, 2019
Monday, January 28, 2019
Distributed Phoenix Chat using Redis PubSub
Using Redis
https://www.reddit.com/r/elixir/comments/aj2sf7/distributed_phoenix_chat_using_redis_pubsub/
https://www.poeticoding.com/distributed-phoenix-chat-using-redis-pubsub/?utm_source=reddit&utm_campaign=reddit_elixir_350
Using pg2 instead of Redis
https://www.poeticoding.com/distributed-phoenix-chat-with-pubsub-pg2-adapter/?utm_source=reddit&utm_campaign=reddit_programming_382
https://www.reddit.com/r/elixir/comments/aj2sf7/distributed_phoenix_chat_using_redis_pubsub/
https://www.poeticoding.com/distributed-phoenix-chat-using-redis-pubsub/?utm_source=reddit&utm_campaign=reddit_elixir_350
Using pg2 instead of Redis
https://www.poeticoding.com/distributed-phoenix-chat-with-pubsub-pg2-adapter/?utm_source=reddit&utm_campaign=reddit_programming_382
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.
ecommerce - Elixir
Avia Commerce -
https://www.aviacommerce.org/
https://github.com/aviacommerce/
https://www.aviacommerce.org/docs/products.html
https://www.reddit.com/r/elixir/comments/aclbb3/ecommerce_elixir_way_wip_faceted_search_for/
Gitter channel - https://gitter.im/avia-commerce/Lobby
Nectar Commerce -
https://github.com/vinsol/nectarcommerce
https://www.aviacommerce.org/
https://github.com/aviacommerce/
https://www.aviacommerce.org/docs/products.html
https://www.reddit.com/r/elixir/comments/aclbb3/ecommerce_elixir_way_wip_faceted_search_for/
Gitter channel - https://gitter.im/avia-commerce/Lobby
Nectar Commerce -
https://github.com/vinsol/nectarcommerce
Sunday, January 27, 2019
MongoDB with Elixir
https://medium.com/@petecorey/how-to-use-mongodb-with-elixir-ac3f814f8b4a
https://whitfin.io/using-mongodb-with-elixir-phoenix-and-ecto/
Connecting to MongoDB directly from Elixir - https://github.com/ankhers/mongodb
Saturday, January 26, 2019
Friday, January 25, 2019
Wednesday, January 23, 2019
Sunday, January 20, 2019
git - get diff between 2 commits as a nice list of single-line commits
git log --oneline f9fff80..2b6e0da >> commits.txt
Erlang/Elixir related
Elixir/Erlang String handling - https://www.evanmiller.org/elixir-ram-and-the-template-of-doom.html
Advantages of using Erlang - https://www.evanmiller.org/why-i-program-in-erlang.html
Advantages of using Erlang - https://www.evanmiller.org/why-i-program-in-erlang.html
Saturday, January 12, 2019
Wednesday, January 9, 2019
Sunday, January 6, 2019
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:
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"}
Saturday, January 5, 2019
Monday, December 31, 2018
Sunday, December 30, 2018
Thursday, December 27, 2018
Linux: Prevent SSH timeout
https://bjornjohansen.no/ssh-timeout
In ~/.ssh/config add the following line:
ServerAliveInterval 30
This will send a “null packet” every 30 seconds on your SSH connections to keep them alive.
Wednesday, December 26, 2018
Friday, December 21, 2018
Thursday, December 20, 2018
Wednesday, December 19, 2018
Monday, December 17, 2018
Friday, December 14, 2018
Javascript - this, bind, call
// this , bind, call
var msg = "global";
function f(x){
console.log(this.msg + "," + x);
}
var obj1 = {
msg: "obj1",
f: f
}
var obj2 = {
msg: "obj2"
}
f(10);
obj1.f(10);
f.call(obj2, 10);
// f.call(window, 10);
// f.call(obj1, 10);
// f.call(obj2, 10);
// f.bind(obj1)(10)
// f.bind(obj2)(10)
// f.bind(window)(10)
var msg = "global";
function f(x){
console.log(this.msg + "," + x);
}
var obj1 = {
msg: "obj1",
f: f
}
var obj2 = {
msg: "obj2"
}
f(10);
obj1.f(10);
f.call(obj2, 10);
// f.call(window, 10);
// f.call(obj1, 10);
// f.call(obj2, 10);
// f.bind(obj1)(10)
// f.bind(obj2)(10)
// f.bind(window)(10)
Thursday, December 13, 2018
Wednesday, December 12, 2018
Tuesday, December 11, 2018
Monday, December 10, 2018
Sunday, December 9, 2018
Config in Elixir projects
Excerpt from Elixir Cookbook -
The configuration from the imported files will override any existing configuration (with the same key) in the config.exs file. In fact, Configuration values are merged recursively. See the example at https://github.com/alco/mix-config-example.
To access configuration values, we use Application.get_env(:app, :key).
Friday, December 7, 2018
Thursday, December 6, 2018
Tuesday, December 4, 2018
Saturday, December 1, 2018
AWS Cloud Development Kit
AWS re:Invent 2018: Infrastructure Is Code with the AWS Cloud Development Kit (DEV372)
https://www.reddit.com/r/programming/comments/a22fay/aws_infrastructure_as_code_using_aws_cdk/
Monday, November 26, 2018
Sunday, November 25, 2018
PostgreSQL & Homebrew
https://stackoverflow.com/questions/15301826/psql-fatal-role-postgres-does-not-exist
If you're using postgres from Homebrew, then you want
If you're using postgres from Homebrew, then you want
/usr/local/Cellar/postgresql/9.2.4/bin/createuser -s postgres (for version 9.2.4, obviously). Saturday, November 24, 2018
Thursday, November 22, 2018
Database Indexes - How to determine if an Index is required or not
https://dba.stackexchange.com/questions/56/how-to-determine-if-an-index-is-required-or-necessary
http://blog.celerity.com/how-to-design-sql-indexes
http://blog.celerity.com/how-to-design-sql-indexes
22/08/2017, 19:03:36B-Trees in databases are not binary trees, they are BALANCED trees
Tuesday, November 20, 2018
UUID related
Seems like an exercise in trying to hack something using UUID guessing -
https://medium.com/@evinsellin/communicating-through-uuid-conflicts-fe50134304db
Labels:
computer science,
web applications
Electron, Desktop PWAs
Medium article:
https://medium.com/dailyjs/goodbye-electron-hello-desktop-pwas-f316b8f39882
YouTube video:
https://medium.com/dailyjs/goodbye-electron-hello-desktop-pwas-f316b8f39882
YouTube video:
Sunday, November 18, 2018
Saturday, November 17, 2018
Sunday, November 11, 2018
Friday, November 9, 2018
Wednesday, November 7, 2018
Database related - Composite Indexes
How do composite indexes work - https://stackoverflow.com/questions/795031/how-do-composite-indexes-work
https://stackoverflow.com/a/795068
https://stackoverflow.com/a/795068
Composite indexes work just like regular indexes, except they have multi-values keys.
If you define an index on the fields (a,b,c) , the records are sorted first on a, then b, then c.
Example:
| A | B | C |
-------------
| 1 | 2 | 3 |
| 1 | 4 | 2 |
| 1 | 4 | 4 |
| 2 | 3 | 5 |
| 2 | 4 | 4 |
| 2 | 4 | 5 |
- 12 Please note also that indexes are stored as Btree, so an (a,b,c) index will help on a search on (a) and on (a, b),
"MySQL can use multiple-column indexes for queries that test all the columns in the index, or queries that test just the first column, the first two columns, the first three columns, and so on. If you specify the columns in the right order in the index definition, a single composite index can speed up several kinds of queries on the same table." - Multiple-Column Indexes – AlikElzin-kilaka Sep 9 at 4:46
https://stackoverflow.com/questions/2349817/two-single-column-indexes-vs-one-two-column-index-in-mysql
https://stackoverflow.com/questions/179085/multiple-indexes-vs-multi-column-indexes?rq=1
https://stackoverflow.com/questions/2349817/two-single-column-indexes-vs-one-two-column-index-in-mysql
https://stackoverflow.com/questions/179085/multiple-indexes-vs-multi-column-indexes?rq=1
Monday, November 5, 2018
Thursday, November 1, 2018
Subscribe to:
Posts (Atom)
MIPA