What’s the difference between using “let” and “var” to declare a variable in JavaScript?

ECMAScript 6 introduced the let statement. The difference is scoping. var is scoped to the nearest function block and let is scoped to the nearest enclosing block, which can be smaller than a function block. Both are global if outside any block. Also, variables declared with let are not accessible before they are declared in … Continue reading What’s the difference between using “let” and “var” to declare a variable in JavaScript?

Making async http requests with python-aiohttp

In this post I’d like to test limits of python aiohttp and check its performance in terms of requests per minute. Everyone knows that asynchronous code performs better when applied to network operations, but it’s still interesting to check this assumption and understand how exactly it is better and why it’s is better. I’m going … Continue reading Making async http requests with python-aiohttp

Embracing Change: Rails 5.1 Adopts Yarn, Webpack, and the JS Ecosystem

For many years, Ruby on Rails has been the go-to framework for startups, micropreneurs, SMBs, and really for anyone who needed to build and launch a tool quickly. With its opinionated, convention over configuration approach, and Heroku’s brilliant git push to deploy feature, Ruby on Rails made every other solution look barbaric by comparison. But … Continue reading Embracing Change: Rails 5.1 Adopts Yarn, Webpack, and the JS Ecosystem

A short summary of centrality in graph theory

A short summary of mathematics of networks (in particular, centrality). In graph theory and network analysis, indicators of centrality identify the most important vertices within a graph. Applications include identifying the most influential person(s) in a social network, key infrastructure nodes in the Internet or urban networks, and super-spreaders of disease. Centrality concepts were first … Continue reading A short summary of centrality in graph theory

How to rename all files in a folder using Python

let's assume the folder is user_data, relative to the current working directory (where the Python script is in). The code below was tested on Windows. import os for filename in os.listdir("./user_data"):     # print(filename)     cwd = os.path.dirname(os.path.abspath(__file__)) + '\\user_data\\'     if filename.split('.')[1] == 'jpg':         new_filename = filename.split('.')[0] + '_search' + '.jpg'         print(new_filename) … Continue reading How to rename all files in a folder using Python