Friday, May 12, 2023

Push into an Array in JavaScript


let myarray = [1,2,3,4,5]


// Add to the start of an array

Array.unshift(element);

myarray.unshift(100); // output 100,1,2,3,4,5


// Add to the end of an array

Array.push(element);

myarray.push(100); // output 1,2,3,4,5,100



// Add to a specified location

Array.splice(start_position, 0, new_element...);

myarray.splice(2, 0, 100,200); // output 1,2,100,200,3,4,5



// Add with concat method without mutating original array

let newArray = [].concat(element);

let newmyarray = myarray.concat(10,20);


Monday, April 17, 2023

Image CSS property aspect-ratio, object-fit and mix-blend-mode

Three CSS properties will help you to display images

1) The aspect-ratio property maintains the aspect ratio of an element, even if its size changes.

2) Object-fit controls how an image or video is displayed within its container, allowing for versatile scaling and cropping options.

3) Mix-blend-mode creates stunning visual effects by blending the colors of overlapping elements.

These powerful techniques can elevate your website's design to the next level, impressing your visitors with visually stunning layouts.


Before


After



Monday, April 10, 2023

_sppagecontextinfo Get current user details

While using CSOM, we have mostly required some details of the current users, like, Name, Email, Title (Designation), Manager, etc., Following code, will help to know all this with simple API calls.


Monday, April 3, 2023

Get week number of month from Date

People struggle a lot when it needs to get a week from a date, here below is a simple example to get the week number of the month from a Date.

Monday, January 9, 2023

Responsive and Animated Pie Charts with HTML and CSS

Responsive and Animated Pie Charts

Thanks to Temani Afif, code on CodePen.

OutPut

Micro-Skills

  • Additive642
  • Multiplicative358

Categories

  • Horizontal768
  • Vertical232

Operations

  • Addition486
  • Subtraction156
  • Multiplication215
  • Division143

Tuesday, January 3, 2023

Excel - Add and Remove Line Breaks in a Cell

Many time we struggle for the line break in a multiple excel cells. This article have some useful tricks that will help you to achive this easily.

1) Manully add line break in a cell using "Alt + Enter".
- Edit the cell with F2 or while typing in a cell when you press "Alt + Enter" it will create new line in a cell.
- To remove a line break, edit the cell with F2, go to the start of line break and press "Backspace" and enter.

2) Line break using formula:
- You can use line break character in CHAR(10) function. Here 10 is the line break character.
- example: CONCATENATE("Rakesh" , CHAR(10) , "Patel"), if you can't see the line break when you  press ENTER, then apply WRAP TEXT to the cell.

3) Replace "," or any other character with New Line:
- Press CTRL + H, this will open "Find and Replace" window. Under "Find what" you can put your text that you want to search. and under "Replace with" press CTRL + J (you won't able to see anything) just click on "Replace" or "Replace ALL". This will will add line break wherever it finds your text.
- The same way you can replace Line break with any of your text.

If "CTRL + J" does not work for you then you can also try Alt + type 0010

Wednesday, December 7, 2022

Delete Files and Subfolders from SharePoint Library using PowerShell

Make life easy with PowerShell, following script will help you to delete all files and subfolders in One Go.