Python packages and the purpose of __init__.py file

Packages are a way of structuring Python’s module namespace by using “dotted module names”. For example, the module name A.B designates a submodule named B in a package named A. Just like the use of modules saves the authors of different modules from having to worry about each other’s global variable names, the use of … Continue reading Python packages and the purpose of __init__.py file

Redis Quick Start on ubuntu

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of … Continue reading Redis Quick Start on ubuntu

Real-Time Rails: Implementing WebSockets in Rails 5 with Action Cable

Recent years have seen the rise of "the real-time web." Web apps we use every day rely on real-time features—the sort of features that let you see new posts magically appearing at the top of your feeds without having to lift a finger. While we may take those features for granted, they represent a significant … Continue reading Real-Time Rails: Implementing WebSockets in Rails 5 with Action Cable

Install PostgreSQL on ubuntu

Introduction PostgreSQL is a powerful object-relational database management system, provided under a flexible BSD-style license.[1] PostgreSQL contains many advanced features, is very fast and standards compliant. PostgreSQL has bindings for many programming languages such as C, C++, Python, Java, PHP, Ruby... It can be used to power anything from simple web applications to massive databases … Continue reading Install PostgreSQL on ubuntu

helper_method in Rails

The method helper_method is to explicitly share some methods defined in the controller to make them available for the view. This is used for any method that you need to access from both controllers and helpers/views (standard helper methods are not available in controllers). e.g. common use case: #application_controller.rb def current_user @current_user ||= User.find_by_id!(session[:user_id]) end … Continue reading helper_method in Rails

Sublime Text reindent, autoindent, and autocomplete

You can find it in Edit>>Line>>Reindent, but it does not have a shortcut by default. You can add a shortcut by going to the menu Preferences - Keybindings-User, then add there (the config file takes as a JSON format): [ { "keys": ["f12"], "command": "reindent"} ] (example of using the F12 key for that functionality) … Continue reading Sublime Text reindent, autoindent, and autocomplete

Getting Started with Node.js for the Rails Developer

Introduction In this article we are going to do a quick introduction to Node.js for Ruby on Rails minded developers. From Ruby to Node You’ve likely heard in the past few months that some big companies are starting to deploy Node applications in production and at scale. Walmart is running their entire mobile site on Node, … Continue reading Getting Started with Node.js for the Rails Developer