teleren/devto huggingface dataset:
Convert firestore admin timestamp to date in javascript/nodejs/nextjs
Tags: javascript, firebaseadmin, node, nextjs
Published: 2023-11-24 13:29:01

Recently I was working on a Nextjs project where I was using @google-cloud/firestore package to write and read data from firestore.

I had createdAt and updatedAt timestamps inside documents which I wanted to convert to data object on the frontend.

Since timestapms created using server side firestore package (@google-cloud/firestore or firebase-admin/firestore) timestamps containes "_" prefix with seconds and nanoseconds keys 

```
{ _seconds: 1700832176, _nanoseconds: 968000000 }
```

and if we try to convert this timestamp to date on frontend it gives error.

```
TypeError: user.updatedAt.toDate is not a function
```

To fix this error you have to convert this timestamp to date object on the server. for example in Nextjs api route.

```
import { NextResponse } from "next/server";
import { db } from "./database";


export async function GET(req: Request) {

  try {
    const collectionRef = db
    .collection("users")

  const snapshot = await collectionRef.get();
  const users = snapshot.docs.map((doc) => {
    const data = doc.data();
    return {
      id: doc.id,
      ...data,
      updatedAt: data.updatedAt.toDate(),
      appointmentAt: data.appointmentAt.toDate(),
    };
  });
  return NextResponse.json(appointments);
    
  } catch (error) {
    return NextResponse.json(error, {status: // status you want send })
  }
}
```
sort using python
Tags: python, tutorial, programming, beginners
Published: 2023-11-24 13:41:05

**Question:**

You are given a list of tuples, each containing a string and an integer. Your task is to sort the list based on the string in descending order, and if two strings are the same, sort them based on the integer in ascending order. Implement a Python function to achieve this.

```python
def custom_sort(input_list):
    # Your code here

# Example usage:
input_list = [('apple', 3), ('banana', 1), ('orange', 2), ('apple', 1), ('banana', 2)]
result = custom_sort(input_list)
print(result)
```

**Solution:**

```python
def custom_sort(input_list):
    # Sort based on string in descending order, then by integer in ascending order
    input_list.sort(key=lambda x: (x[0], -x[1]), reverse=True)
    return input_list

# Example usage:
input_list = [('apple', 3), ('banana', 1), ('orange', 2), ('apple', 1), ('banana', 2)]
result = custom_sort(input_list)
print(result)
```

This solution uses the `sort` method with a custom key function to achieve the specified sorting criteria.
How To Price SaaS Products Accurately
Tags: saas
Published: 2023-11-24 13:34:16

**In today's video I teach how to price [SaaS products accurately](https://youtu.be/4TYaog-ljG0). No matter the stage or level of your business, my process will enable you to create the correct pricing.

I help you take information and data you have gathered and turn them into pricing. Additionally, I use an example to illustrate my teaching points. Watch below to learn how to price your SaaS Products precisely.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4jod7yo9ylips2cyqgcy.png)
You dont need JS for that? 🤯
Tags: webdev, javascript, html, css
Published: 2023-11-24 13:33:50

Since, the introduction of HTML5 and CSS3, lot of design decisions which were only possible with JavaScript were now possible to be achieved with HTML and CSS. Here in this article we will be looking at some of those utilities which you can make use of for your next web app, and reduce the JavaScript overhead.

## [:target](#:target)

**:target** is a CSS pseudo-class that selects an element targeted by the URL fragment identifier (#). When a link with a corresponding ID is clicked, it activates the associated element's styling, enabling dynamic changes or visual cues based on user interactions with the URL.

![:target Example](https://raw.githubusercontent.com/shubhambattoo/blog-assets/1a51050884d8ef73b53ba607577e953a15c6a834/target.gif)

[See Example](https://codepen.io/shubham997/full/yLKLXpv)


## [Details Accordian](#details-accordian)

The `<details>` tag in HTML is used to create a disclosure widget that can be toggled open or closed to reveal or hide content. It acts as a container for supplementary information, typically within an interactive dropdown or collapsible section. This tag is often coupled with the `<summary>` tag, which provides a visible heading or label for the collapsible content.

![Details Example](https://raw.githubusercontent.com/shubhambattoo/blog-assets/main/details.gif)

[See Example](https://codepen.io/shubham997/full/NWYWvGY)

## [Dialog](#dialog)

The `<dialog>` tag in HTML represents a dialog box or modal in a document. It provides a way to create pop-up dialogs or modal windows within a web page, typically used for interactions that require user attention or action. By using JavaScript and the showModal() method, developers can control the display and behavior of the `<dialog>` element.

![Dialog Example](https://raw.githubusercontent.com/shubhambattoo/blog-assets/main/dialog.gif)

[See Example](https://codepen.io/shubham997/full/WNzNErJ)

Embracing these versatile HTML elements and CSS features can significantly enhance user experiences, offering a seamless blend of interactive design and functionality on the modern web.
Exploring the unusual: JavaScript arrays and the 'in' operator
Tags: webdev, javascript, in, operators
Published: 2023-11-24 13:30:28

## The 'in' operator of JavaScript
JavaScript is one of the weirdest programming languages both syntactically and by use case. JavaScript is widely used to create fullstack websites, cross-platform mobile applications and even desktop applications. Inspite of it wide usage, JavaScript with its different features can make the developer go nuts.  One such thing is the 'in' operator.

In other programming languages like Python, the 'in' keyword directly represents its semantic meaning, i.e., usage of 'in' keyword checks for the presence of an item in an iterable.  Whereas in Javascript, the 'in' operator checks for the presence of a particular property in an object. Doesn't sound strange right? The peculiarity becomes even more evident when using 'in' operator with arrays.

## 'in' operator with JavaScript objects
  As mentioned earlier, the 'in' operator is used to check for the presence of a property in a JavaScript object. 
For example, 

```
const shoppingCart = { 'apple': 1, 'banana': 5, 'pears': 3 }
console.log( 'apple' in shoppingCart ) //Output: true
```
The above code is said to return true. But what if it was used in an array?

## 'in' operator with JavaScript arrays
```
const shoppingCart = [ 'apple', 'banana', 'pears' ] 
console.log( 'apple' in shoppingCart ) //Output: false
```
Semantically, it should return true instead, it returns false. Why is this happening ?  Behind the hood, Javascript's 'in' operator checks for the existence of an index and so the unexpected answer.  Let's see something more weird.

```
const shoppingCart = [ 'apple', 'banana', 'pears' ]
console.log( '1' in shoppingCart ) //Output: true
```
The above snippet returns true, because the 'in' operator checks for the presence of an element at the '1'st index instead of checking for the presence of an actual '1' in the array. Let's see what happens under the hood in JavaScript arrays.

## Behind the scenes of JavaScript arrays
Arrays are interpreted as objects by JavaScript. The _shoppingCart _array defined above is interpreted by JavaScript as follows: 

```
const shoppingCart = { 0: 'apple', 1: 'banana', 2: 'pears', length: 3}
```
This clearly explains the behaviour of the 'in' operator.  So, it checks whether the '1'st index is actually not undefined. If it does, it returns true else false.  But why do someone dare to use it with the JavaScript arrays? The answer is, 'in' operator with the JavaScript arrays checks for the presence of a particular index. If you wish to learn more about the 'in' operator, check out the official docs on MDN: {% embed https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in %}
My New Nextjs Project "Devletter" 🔥
Published: 2023-11-24 13:17:48

**My New Nextjs Project "Devletter"**

**Hey everyone,**

I'm excited to share that I just finished building this project - Devletter - using the popular frontend framework Nextjs. Creating this project has been a super fun learning experience for me.

{% cta https://devletter.vercel.app/ %}Checkout this 🔥{% endcta %}

## 😅What is Nextjs ?

Nextjs allows you to build fullstack React apps that generate HTML and CSS at build time. This **"pre-rendering"** makes the apps feel really snappy since everything loads instantly when you first visit. I was really impressed by how easily Nextjs handles routing, data fetching, and code splitting out of the box. No more worries about configuring Webpack or Babel - Nextjs does it all automatically behind the scenes.

## Purpose to build Devletter ? 🤔

For Devletter, I wanted to build a **simple newsletter platform** where developers can join with their E-mail Address And they get weekly e-mail from devletter of Tech news, new projects, blogs, and tech events each week. The main content area displays a list of the latest posts which users can click into to read full articles. 

> Thanks for taking the time to check out my first project - let me know if you have any other questions!

## Happy Coding 👋
How Big Data Analytics in Gaming Improves Player Experience
Tags: bigdataanalytics, dataanalytics, dataanalyticsingaming
Published: 2023-11-24 13:03:30

Leveraging big data analytics in gaming is a thoughtful approach to enhancing the gaming experience. Most gaming businesses are increasingly making decisions based on [big data analytics and insights](https://www.bluent.com/business-services/enterprise-data-management/). These gaming companies count on players' data to emerge in the gaming industry and grow exponentially.

According to Statista, the global gaming market will surpass an annual revenue of USD 268.9 billion in 2025- up from $178 bn in 2021. Alongside Asian regions, the growth rate of the gaming sector will witness a sheer increase in North American states.

Also, the current user penetration rate in the video gaming segment is 35.2%, which will hit 39.0% by 2027.

Shooter and action-adventure games are the most popular among various genres of video games. What makes such games so popular & engaging?

Data science could be one of the reasons why developers can improve games. They use analytical data based on users' behavior and gaming preferences to add features they will most likely choose during virtual gameplay.

Let us discover more about the role of data and gaming analytics in this blog.

**Delving into Big Data in the Gaming Industry**

The gaming businesses have enjoyed immense popularity in the last few years. All thanks to the rapid digitalization and diverse adoption of smartphone technology.

In the initial days, most mobile phone games required only an internet connection with a decent speed. That used to be fair enough to offer a great gaming experience.

Soon after that, [the evolution of gaming](https://www.bluent.net/blog/evolution-of-gaming/) introduced multiplayer games, allowing gamers to play with their friends. Later, the advent of AR/VR headsets and Metaverse technology also transformed a lot about virtual gaming.

Source by: [https://www.bluent.net/blog/role-of-data-analytics-in-gaming/](https://www.bluent.net/blog/role-of-data-analytics-in-gaming/)
41. Black Friday no-study (Day 39)
Published: 2023-11-24 12:51:10

I have a set of excuses for not doing any study today:

- It was a rainy day, so I got dreamy.
- Had an intense fitness training session.
- Needed time to order some Black Friday stuff!!
- Had to meal prep also.
- Change my banking institution.

Sorry. Apologizing to myself actually. But I am making it up this weekend with a possible 16-hour study. I have my second assignment due on 10th December, and I really to get started on that one. I am also planning to do some study of Python - basically going through 3 of the recorded lectures, about 6 hours!

If you are interested to know what I am getting for my Black Friday sale, here it is:

- Cable management items
- Amazon Echo Pop
- A smart plug

It's all tech stuff :)

_Time: 11:50 PM - Good night!_
Next-Level Wearables: TechnBrains, Your Expert App Development Partner
Published: 2023-11-24 12:38:44

Elevate your wearable experience with TechnBrains – the ultimate destination for cutting-edge smartwatch apps. Our expert developers create precise, efficient solutions for Android and iOS. Benefit from our unique approach, expert development, and top-notch features. Choose TechnBrains for unparalleled excellence in [wearable app development](https://www.technbrains.com/mobile-application/wearable-app-development/) technology.
Your values are 'Truthy' or 'Falsy', JavaScript
Tags: webdev, javascript, tutorial, programming
Published: 2023-11-24 12:33:41

# "Truthy" and "Falsy" value in JavaScript.
<br />
When I am taking about truthy and falsy value, I am talking about Boolean type in JavaScript.  As computer only understand 0 or 1, true or false so, JVM also understand only truthy or falsy value.
<br />
## What are these?

- JVM only need to understand about truthy or falsy values, at the time of evaluation in Boolean context of expression or statement.
- These truthy or falsy values may not be strictly Boolean true or false but it treated as Boolean value in conditional statement.

## All 6 Falsy values

1. Empty string (' ')
2. Boolean false
3. Numeric zero (0)
4. NaN (Not a Number)
5. null
6. undefined

> _Except these 6 values all other values are treated as Truthy value in JavaScript._

```javascript
console. log(0, Boolean(0)) // false
console. log(undefined, Boolean(undefined)) // false
console. log(null, Boolean(null)) // false
console. log(NaN, Boolean(NaN)) // false
console. log('', Boolean('')) // false
console. log(false, Boolean(false)) // false
```

```javascript
console.log(1, Boolean(1)) // true
console. log(-1, Boolean(-1)) // true
console. log('dct',Boolean('dct')) // true
console. log([], Boolean([])) // true
console. log({}, Boolean({})) // true
console. log(true, Boolean(true)) // true
```

---

Correct me if I am wrong!!!

[**Linkedin**](https://www.linkedin.com/in/milan-mohapatra/) | [**Twitter**](https://twitter.com/nextDevMillion) | [**GitHub**](https://github.com/TheGrayGodfather)
Building Information Modeling (BIM) service - Aesthetic Designs LLP
Tags: bim
Published: 2023-11-24 12:26:11

Ready to revolutionize construction with cutting-edge [BIM](https://www.aestheticdesigns.in/services/bim/) technology? Discover how choosing the right firm can mitigate risks and reduce costs. Talk to our experts for BIM services.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3m9i9y3pdqjrik1t1cec.png)
Ballet Classes London
Tags: balletclasses, danceclasses
Published: 2023-11-24 12:20:09

In the core of London's energetic expressions scene, where history meets development, European Dance School arises as a reference point of greatness in the domain of expressive dance. For those trying to refine their masterfulness, the [ballet classes london](https://europeandancecollegeacademy.blogspot.com/2023/11/ballet%20-classes-london.html) presented by European Dance School are a door to a universe of beauty, accuracy, and self-articulation. This article digs into the unrivalled advantages, different class contributions, and one-of-a-kind elements that settle on European Dance School a champion decision for artful dance fans in London.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/esty07lhqbeuf0fxdwcu.jpg)
Get Certified in Scrum PSM-I with Our Dumps
Published: 2023-11-24 07:55:08

Scrum [PSM-I Dumps](https://dumpsboss.com/scrum-exam/psm-i/) PDF: PSM-I Dumps PDF clean to down load No extra software program required for PSM-I PDF document. Instant get entry to to the Professional Scrum Master I have a take a observe cloth PSM-I Exam Topics smart syllabus PSM-I Exam Practice Test Questions and Answers are Printable Scrum PSM-I Practice Test Software Scrum PSM-I Practice Exam software program is the real PSM-I Exam simulation Scrum PSM-I Mock Tests on your Professional Scrum Master I PSM-I examination guidance Easy to down load Scrum PSM-I PDF Dumps Exam Questions.

Instant get entry to to the Scrum examination (PSM-I) Real Questions and Verified Answers Scrum [PSM-I Exam Dumps](https://dumpsboss.com/scrum-exam/psm-i/) check software program customise your PSM-I Dumps exercise examination questions as in step with requirement Latest Scrum PSM-I Exam  Pass With Guarantee: certain that if a candidate Prepare PSM-I Dumps Questions Answers properly, he's going to clean the PSM-I Exam in a single try.  PSM-I Actual Exam Dumps with PDF assures which you could now no longer lose something in case you fail to get Professional Scrum Master PSM-I Certification in a single try. Why PSM-I check simulator and examination dumps are vital to bypass Professional Scrum Master certification examination? 

Get up-to 40% off✔ https://dumpsboss.com/scrum-exam/psm-i/
Controlling Deletion: How Azure Resources Utilize Multiple Delete Locks
Published: 2023-11-24 12:13:03

Benefits of Multiple Delete Locks
Enhanced Security Measures
Multiple delete locks fortify <a href="https://dumpsmedia.com/education/an-azure-resource-can-have-multiple-delete-locks/">An Azure Resource can have Multiple Delete Locks</a> resource security, providing an added layer of defense against accidental or unauthorized deletions.
Limitations & Best Practices
Although multiple delete locks offer heightened protection, overusing them might complicate resource management. We'll explore best practices and potential limitations.
Introduction
Welcome to the world of Azure resources! In this article, we'll explore the significance of delete locks within Azure, their types, management, and an intriguing concept: multiple delete locks.
Understanding Azure Resources
Azure resources are fundamental components used to construct and manage applications in the Microsoft Azure cloud. These resources can range from virtual machines to databases, catering to various functionalities.
What are Delete Locks?
Types of Delete Locks
Delete locks are pivotal safety measures in <a href="https://dumpsmedia.com/education/an-azure-resource-can-have-multiple-delete-locks/">An Azure Resource can have Multiple Delete Locks</a> . They prevent accidental deletion or modification of essential resources. These locks come in two primary forms: CanNotDelete and ReadOnly.


Click Here For More Details>>>>>>>https://dumpsmedia.com/education/an-azure-resource-can-have-multiple-delete-locks/
Announcing free Tailwind and Nuxt.js code starter for Podcasts
Published: 2023-11-24 12:05:17

If we release a free code starter every Friday, does that mean Black Friday is always at the end of the week? 🤔

It's not about special offers or deals but more about offering special solutions. This Friday, we crafted one for all podcasters!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lmaqk0qnfpvh8wqplxv4.jpg)

Introducing Podcast code starter for BCMS, Nuxt & Tailwind. 😍

🔗Demo:https://thebcms.com/starters/podcast

📁Code: https://github.com/bcms/starters/tree/master/nuxt/podcast

Some features:

Responsive and mobile-friendly website
Pre-designed pages
Fast loading time
Free

📖 Read more: https://thebcms.com/blog/podcast-code-starter-bcms-nuxt

Support ❤️: If you like the project, hit that ⭐ [button on GitHub](https://github.com/bcms/starters).
Maximizing Productivity: How I Optimize My Coding Workspace with an External Monitor
Published: 2023-11-24 12:04:24

Let's talk about using an external monitor as your primary screen and extending it with your laptop as a secondary screen.

1: The Power of a Big Monitor
A larger monitor gives you more screen space to work comfortably. You can view your main tasks—coding, designing, or anything else—with ease. 

2: Extending with Your Laptop
By extending your monitor with your laptop, you create a seamless workflow. Aligning them parallel allows for easy transition between screens, offering a natural flow as you move your cursor or applications between the two.

3: Comfort and Ergonomics
Using a separate keyboard and mouse alongside the large monitor supports better posture and reduces strain compared to working solely on a laptop. It's a game-changer for comfort during long coding sessions.

4: Multi-tasking Made Easy
The extended setup allows for efficient multitasking. Your main work occupies the larger screen while supplementary tools, documentation, or communication apps can sit open and accessible on the extended laptop screen.

5: Flexibility
This setup you can detach the laptop for on-the-go work while maintaining a consistent workspace when connected to the larger monitor. It's a flexible arrangement.

6: Personalizing Your Workspace
The beauty of this setup is its adaptability. Arrange your workspace to suit your preferences, ensuring a comfortable and productive working environment that's uniquely yours.

Conclusion:
Combining a big monitor with an extended laptop screen has been a game-changer for me. It's comfortable and efficient setup that maximizes productivity and minimizes distractions.
How to Choose the Best BPO Company in India?
Tags: bpocompany, bposervices, bestbpocompany, ascentbpo
Published: 2023-11-24 12:00:28

Today, business process outsourcing has become a growing trend. With so much data and consumers to manage, corporate confidence in [Best BPO Company](https://www.ascentbpo.com/bpo-companies) has grown over the years. India’s IT and [BPO services](https://www.ascentbpo.com/bpo-services) sector has grown rapidly since its inception in the mid-1990s and today has a turnover of US$37.6 billion. The Indian BPO market has grown due to economies of scale, reduced business risk, cost advantages, improved utilization, and superior experience. Among competitors such as Australia, China, the Philippines, and Ireland, India is now the world’s leading hub for the consumption of BPO services. India’s immense popularity as a global outsourcing destination is due to the country’s Ascent BPO to provide better services at reasonable prices.

 
However since many organizations in India offer quality data entry services, companies only need to choose the best ones after they have done their homework. Look on our website to learn how to choose the [Best BPO Company](https://www.ascentbpo.com/) like us.

What is business process deployment or outsourcing (BPO)?

Before we get started, we want to give our audience an overview of what a BPO is. [Business process outsourcing companies](https://www.ascentbpo.com/bpo-process-outsourcing) provide services that allow companies to focus on their core business. Let us consider this problem in detail. You may not have the time or resources for a separate organization that you can trust to handle other aspects of your business. These other aspects can be anything from call center operations, marketing, SEO, and finance to human resource activities. The sky is the limit. Now that business process outsourcing has sparked some interest, let’s explain what to look for in the Best BPO company.

**Read More:** [BPO Process Provider in India](https://www.ascentbpo.com/bpo-companies)
28h. Left: TWE Elements Up To 500$ OFF❗️
Tags: javascript, news, tailwindcss, css
Published: 2023-11-24 11:53:20

**Up to 500$ OFF❗️**
_#BlackFriday Promo_

✔️500+ #opensource components for #TailwindCSS
✔️LIFETIME Usage
✔️Commercial license (non AGPL)
✔️Support
✔️12 months of updates
✔️Design blocks
✔️And More❗️


Only for  #BlackFriday

Only 28 hours left❗️

[Hurry Up❗️](https://tw-elements.com/pro/)