Categories
Azure

How to use Lifecycle Management rules of Azure Blob

Azure has a built-in feature to change the Access tier from Hot to Cool. Along with this feature, Azure has other options like moving to Archive Storage, Deleting Blob. Below are the steps to set up the rule(s). Login to Azure portal Create blob storage or go to the existing blog storage. On the left […]

Categories
wordpress

How to Integrate PayKun Payment Gateway in WordPress

It is easy and hasslefree to integrate the WordPress websites with the available Plugins from PayKun Payment Gateway. With PayKun WordPress Plugins you do not require any technical knowledge because the steps are very basic and enable smooth integration with your site. It supports WooCommerce >= 2.4, including the new 3.0 release. With PayKun WordPress […]

Categories
Unix/Linux

How to download YouTube live stream video in chunks

In this tutorial, we gonna download YouTube live stream video in chunks for the given interval. We gonna run few commands in the terminal for this task, you can use any programming language to do the same to automate things. FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. Using […]

Categories
Javascript / JQuery Snippets

Docker file for Express App with PM2

FROM node:10 WORKDIR /usr/src/app COPY package*.json ./ RUN npm install pm2 -g RUN npm install COPY . . EXPOSE 8080 CMD [“pm2-runtime”, “server.js”]

Categories
Javascript

Node.js 12: Private Class Fields

Javascript allows us to declare fields inside the class. We can access its own fields or properties by creating an instance of a class. Example: As specified as of 2019, We can now declare private fields using #. Using private fields the implementation details of a class are kept internal and are not exposed to […]

Categories
PHP / MySQL

PHP 7.4 – Null coalescing assignment operator

The null coalescing assignment operator is a shorthand for null coalescing operations. Let’s take a example code So, instead of writing the previous code, we could write the following: If the value of the left-hand parameter is null, then the value of the right-hand parameter is used.

Categories
PHP / MySQL

PHP 7.4 – Arrow functions

Arrow functions also called “short closures”. We can always access the parent scope, there’s no need for the use keyword. Here is a simple example with an arrow function. Above code we can write as show below without arrow function

Categories
Laravel

Eloquent – A better way to increment or decrements an int

Laravel has in-built increment() and decrement() functions to increase or decrease a value of the column, by 1 or with the given number. Below are the examples: That’s it – it will actually run update column + 1 under the hood. You can specify a second parameter to this function, the amount of incrementing. The […]

Categories
Javascript / JQuery Snippets

Difference between two date in JavaScript

Let us see an example of how to calculate the difference between dates using Javascript. First, write an HTML code with Javascript as below:

Categories
Laravel Code Snippets

Laravel Drop all tables

This is useful for migrations when you can’t rollback. It can easily be run in artisan mode or you can create a console command.

Categories
PHP / MySQL

PHP 7.4 – Numeric Literal Separator

PHP 7.4 allows for underscores to be used to visually separate numeric values. It looks like this: The underscores are simply ignored by the engine. i.e both are equal.

Categories
Python

How to Connect to SQL Server database using Python, pyodbc

In this post, we gonna use pyodbc package to connect to the SQL server using Python. So let’s install the package using pip package installer. Here is the command to install After installing the pyodbc package, you can use the following code snippet to connect to SQL Server. Here is the simple example code to […]

Categories
Angular 2

How to deploy angular universal to production

This post will cover the step needed to take the angular universal app to the production server. This post assumes that you have running angular universal application and which is generated by angular CLI. Now open your terminal or command prompt, point the cursor to the project folder and run the build command as shown […]

Categories
Node JS

Word document placeholder replacement with Node js

In this post, we gonna see how we can use Docxtemplater library to replace placeholders in the Word Document in Node js based projects.  Let’s initialize the project with npm init –yes command. Now install the Docxtemplater the module as shown below: Now create a file called processWordDoc.js and place the following code. Now execute the […]

Categories
Laravel

How to Upload, download, remove Files to Amazon S3 Using Laravel

Create a controller called UploadController.php with following code. Create a view file Create a file called upload.blade.php in the resources/views directory and place below inside it. Define Routes Open your routes/web.php directory and add following route definitions to it.