Shortcut: String to number in JS
Put a + (plus) operator in front of a string to convert it into a number.
+'12' (string) => 12 (number) let x = '40'; (string) +x => 40 (number)
Reactive Extensions (Rx) Programming
Reactive extensions (Rx) is a set of tools/API available for almost any popular languages/platforms out there, which aids in a new way of asynchronous programming (well, not completely new :p).
Most of the time, the way we write programs, we query data from a data source and wait for that data set to be ready. Once the data from the source is ready, only then we can perform different kinds of operation on it. This waiting process is blocking or synchronous i.e it blocks the program execution and waits for the data to be loaded. What if there was a mechanism that allowed the data source to push data to us and we could perform various kinds of operations on the data as it comes? Welcome to Reactive Extensions (Rx). Rx allows us to do exactly this. It exposes a set of types (Observables & Observers) and operators (operations we can perform on those types) to aid us in asynchronous programming. This way, we don't need to wait for the data by blocking the program execution. Besides, we can perform operations on the data as it comes rather than wait for the whole data set to be ready. Its quite similar to event driven programming where you subscribe to an event by passing a callback and the system will execute the callback whenever an event happens. Although, Rx is much more powerful than just ordinary event driven mechanism.
Most of the time, the way we write programs, we query data from a data source and wait for that data set to be ready. Once the data from the source is ready, only then we can perform different kinds of operation on it. This waiting process is blocking or synchronous i.e it blocks the program execution and waits for the data to be loaded. What if there was a mechanism that allowed the data source to push data to us and we could perform various kinds of operations on the data as it comes? Welcome to Reactive Extensions (Rx). Rx allows us to do exactly this. It exposes a set of types (Observables & Observers) and operators (operations we can perform on those types) to aid us in asynchronous programming. This way, we don't need to wait for the data by blocking the program execution. Besides, we can perform operations on the data as it comes rather than wait for the whole data set to be ready. Its quite similar to event driven programming where you subscribe to an event by passing a callback and the system will execute the callback whenever an event happens. Although, Rx is much more powerful than just ordinary event driven mechanism.
Switching remote URL in git
- Open terminal.
- Change the current working directory to your local project.
- Use the command (this will list the current remote URL):
- git remote -v
- Then issue the following command (this will change the remote URL):
- git remote set-url origin https://your-git-rep-url.git/
- Verify that the remote URL has changed:
- git remote -v
Taken from, GitHub: Changing a remote's URL
Increase the volume!!!
If you're running a linux system and having real trouble in hearing the sound perfectly, maybe you wanted to increase the sound beyond what the system allows (i.e more than 100%). This is where, the "setvolume.py" comes in :)
You use the script like so:
First of all, make the script executable with the command: "chmod +x setvolume.py"
Then "setvolume 70" to set the volume to 70% or "setvolume 150" to set the volume to 150%.
Besides, if you're using a terminal, you know, grabbing the mouse is a pain sometimes. You can use this script to change the system volume through the terminal (and possibly making it globally executable from any location) :D
Why wait, grab the script from here: https://github.com/sazid/setvolume
You use the script like so:
First of all, make the script executable with the command: "chmod +x setvolume.py"
Then "setvolume 70" to set the volume to 70% or "setvolume 150" to set the volume to 150%.
Besides, if you're using a terminal, you know, grabbing the mouse is a pain sometimes. You can use this script to change the system volume through the terminal (and possibly making it globally executable from any location) :D
Why wait, grab the script from here: https://github.com/sazid/setvolume
Subscribe to:
Posts (Atom)
Power function
In C/C++ (and also other languages), we have the built in power function to raise a number to a given power. What if we need to calculate ...
-
GZip compression allows the server to compress data before it is sent (on the fly) and the upon arrival of the data on client side, the br...
-
In C/C++ (and also other languages), we have the built in power function to raise a number to a given power. What if we need to calculate ...
-
Function overloading is an interesting concept and its very useful in some scenarios. So, what is function overloading ? Function overloa...


