To delete a branch and recreate it, both locally and remotely, here is a short shell script that asks for user confirmation and then proceeds to recreate the branch from master. In this example, the branch is development
, the confirmation message is colored red to emphasize precuation, and the script only proceeds once user types exact yes.
JavaScript Flatten Deeply Nested Array of Objects Into Single Level Array
Using plain JavaScript, and lodash's flatMapDeep method.
Requirement: We have a deeply nested array of objects. We want to bring all the nested objects into the array at the root level.
Following is the example array familyTree that has multiple people in the root, and many of them have children array containing further members:
[Read More]
JavaScript Find Path of Key in Deeply Nested Object or Array
Key Path Finder Using Depth First Search (DFS)
The following two codes go through the whole object, an array of objects, or a collection of both to get the path to a particular key. There are two versions: first gets the path to the key only, and second gets the path where a key has the given value.
[Read More]JavaScript Check if Key Exists in Deeply Nested Object or Array of Objects, Without Knowing the Path
Depth First Search (DFS) for Key Verification in an Object
The following JavaScript code recursively goes through the whole object, an array of objects, or a collection of both to verify if the given key exists somewhere down the object. It does not require the path to the key in advance.
A similar recursive solution as below can also be used to modify all the keys of a deeply nested object or array of objects.
[Read More]Size Conversion Between Pixel, Tailwind Classes, and Rem
A cheatsheet for quick tailwind size and font size reference
Assuming you have set 16px
font-size in your project base, following will be the conversion table with examples:
Add A Dropdown List in Suneditor React Using Custom Plugin
Merge Tags Or Insert Variables Can Easily Be Listed For The User To Choose From
In almost all of the text editors available for React JS adding your own dropdown list is not an easy task. In a React app I was using suneditor, and I needed to add my own dropdown list for the users to select a merge tag from, but I could not find a way from their documentation.
[Read More]
Nodejs Script to Add Rows in CSV File Through Terminal
Filling out a CSV file through Office Excel or LibreOffice Calc is easy enough, but you may find it quicker to type in fields on a terminal, particularly when you want to process the data before entry, use defaults, or keep the entry process totally mouse-free.
[Read More]
What Are the Alternatives to Google Places Geocoding Autocomplete?
After the insane price hike of Google Maps, people are looking for its viable alternatives, including geocoding autocomplete services.
We had Google autocomplete text field in one of the apps, with some 20,000 plus autocompleted sessions a month (Google counts autocomplete by session, not per keystroke).
[Read More]
Google Maps Price Hike, Its Effect on Small and Medium Businesses, and Future Repercussions
Maps, Routes and Places; All Got Out of Developers’ Reach
For a long time, and for no fee, developers and entrepreneurs would freely use Google Maps. In 2018, all of a sudden, Google put a price tag on its Maps services, that included three distinct but related products: Maps, Routes, and Places.
[Read More]
How to Get All Uppercase Words from a String in JavaScript
And all lowercase words, too
On rare occasions, Google surprises you by returning no useful information for your search. Extracting numbers and retrieving all uppercase words from a given string in JavaScript were two such problems. In the latter case, there were all kinds of regex examples to find capitalized words or uppercase letters, but not the uppercase words.
[Read More]
When you purchase through links on techighness.com, I may earn an affiliate commission.