author avatar

sujay

Mon Aug 21 2023

Managing multiple variants of a component, such as different styles of buttons, can often be a challenging task, especially as the number of variants grows. Traditionally, developers have resorted to using packages like classnames to dynamically apply classes based on different conditions. However, a more streamlined and organized approach is provided by Class Variance Authority (CVA). CVA offers an elegant solution to handling multiple component variants, promoting maintainability and scalability.

One typical example is the "Button" component, which can possess various visual treatments like primary, secondary, with icons, and diverse icon placements. Instead of relying on cumbersome conditional statements and the classnames package, Class Variance Authority presents an efficient methodology through its documentation, available at https://cva.style/docs.

author avatar

iffyuva

Wed Aug 16 2023

In order to disable pager in postgresql, just use this command \pset pager off. This command is useful for seeing data from tables with huge jsonb data

author avatar

ashwanikumarjha

Thu Aug 03 2023

JSON serialization in API responses omits fields with undefined value to follow the JSON specification. According to the JSON standard, properties with undefined values are not allowed in JSON objects, these are the allowed JSON values: object, array, number, string, true, false, or null.

We need to be mindful while handling the missing data. On the backend, use null or defaults for missing data. On the frontend, ensure data is present before accessing it.

author avatar

ashwanikumarjha

Wed Aug 02 2023

Image Sprites

• Technique to reduce server requests for loading multiple images. • Combine several small images into a single, larger image called a sprite sheet. • Instead of loading multiple individual images separately, we can load a single sprite sheet. • We can refer to individual images within the sprite sheet using CSS background positioning.


.logo {
  background-image: url('client-logos-sprite.png');
  background-repeat: no-repeat;
}

.client1 {
  background-position: 0 0;
}

.client2 {
  background-position: -100px 0;
}```
author avatar

rishav.raj

Mon Jul 31 2023

How to fetch and test those API endpoints which is accessible after login into the applications.

  1. Launch the browser navigate to the login page using playwright
  2. Enter the login credentials and submit the form to login.
  3. After successful login, use playwright API to access the API endpoints.
  4. Make API requests and assert the response to validate the functionality Example of fetching API after login :

const apiEndpointURL = "https://example.com/api/endpoint";
const apiResponse = await page.evaluate(async (url) => {
      const response = await fetch(url);
      return await response.json()
}, apiEndpointURL)

console.log(apiResponse)```
Thanks
author avatar

sujay

Wed Jul 26 2023

Monkey patching in Ruby is dynamic modification of class. It means overwriting existing methods at runtime eg:

  def reverse
    'Reverse op blocked'
  end
end

'Hello'.reverse
>> 'Reverse op blocked'```
author avatar

rishav.raj

Mon Jul 24 2023

how to automate the OTP for cypress test

There is a package called gmail-tester which help use to retrieve mail from the gmail, its have lots of option like from, to, subject, mail_body etc

Package link :https://github.com/levz0r/gmail-tester

If you get the able to get the mail then you are good to go to extract OTP from the mail body after extracting otp from the mail you will able to automate the gmail OTP.

Thanks

author avatar

syedsibtain

Thu Jul 20 2023

Error Monitoring in Bugsnag works similar to Sentry and the commonly used method is bugsnag.notify() . It also takes an error object and captures it as an event. And we can set it up for different environments by using ENV (similar to sentry) or manually configure it as well. FYI: Sentry has a broader approval by developers.

EG:

try {
  // Some code here
} catch (error) {
 bugsnag.notify(
      new Error(`Error ${error} while sending Standup popup`)
    );
}```
author avatar

syedsibtain

Thu Jul 20 2023

In Sentry we have two methods available, captureException() and captureMessage().

  1. captureException() method is used to explicitly report errors and exceptions. We can pass an Error object to captureException() to capture it as an event in Sentry.
  2. captureMessage() method is used to capture a simple message for debugging purposes. Typically, messages captured with captureMessage() are not emitted as events. We can additionally add severity level to this. Available levels are "fatal", "error", "warning", "log", "info", and "debug".
author avatar

vaibhav.yadav

Fri Jul 14 2023

Local storage does not work right off the bat when we render a web page within an App. App Dev will have to ensure that DOM storage is enable for it to work.

Showing 2 to 5 of 41 results