Skip to content

Instantly share code, notes, and snippets.

View sarabs3's full-sized avatar
🎯
Focusing

Sarabjeet Singh sarabs3

🎯
Focusing
View GitHub Profile
1. What is the status of my order #98765?
2. Can you provide details about the features of the XYZ smartphone?
3. What is your return policy for electronics?
4. I received a damaged item in my order. How can I get a replacement?
5. Can you recommend a good smartphone for gaming under $500?
### **FAQ Database:**
#### **Products:**
1. **Product Information:**
- **Question:** "What are the features of the XYZ smartphone?"
- **Answer:** "The XYZ smartphone features a 6.5-inch display, 128GB storage, 6GB RAM, a 48MP camera, and a 4000mAh battery."
2. **Availability:**
- **Question:** "Is the ABC laptop available in stock?"
- **Answer:** "Yes, the ABC laptop is currently in stock. You can place your order online and choose from various delivery options."
let userName: string;
let userAge: number | string = 38;
let users: [string, string];
users = ["David", "henry", "wade"];
@sarabs3
sarabs3 / GenericTypeArrayTypescript.txt
Last active September 28, 2025 18:43
Tuples in Typescript
let userName: string;
let userAge: number | string = 38;
let users: Array<string | number>;
users = ["David", "henry"];
userName = 'Sarab';
userAge = '10';
let schema = yup.object().shape({
general: yup.object().shape({
key1: yup.string().required(),
}),
risk: yup.object().shape({
key1: yup.string().required(),
}),
});
The role attribute describes the role of an element in programs that can make use of it, such as screen readers or magnifiers.
```
<a href="#" role="button">Button Link</a>
```
@sarabs3
sarabs3 / gist:e8754b43e1e526ec8e94f1e5621acf94
Created August 25, 2020 10:50
handleNewMessage function
function* handleNewMessage(message) {
const {user, activeDialogs} = yield select(({quickblox}) => quickblox);
// Find dialog index in activeDialogs array for new message
const dialogIndex = activeDialogs.find(d => d.dialog_id === message.dialogId);
if (dialogIndex) {
// Update dialog in redux
yield put(QBActions.qbDialogsEditSuccess({
...dialogIndex,
lastMessage: message.body,
@sarabs3
sarabs3 / settings.md
Created February 25, 2020 05:12
absolute imports in create-react-app

Step 1: Create a NODE_PATH=/src variable in your .env file for resolving absolute import Step 2: Create a jsconfig.json file in your root directory and paste below settings in it { "compilerOptions": { "module": "commonjs", "target": "es2016", "jsx": "preserve", "checkJs": false, "baseUrl": "./src" },

```
const transactions = [
{
id: 3,
sourceAccount: 'A',
targetAccount: 'B',
amount: 100,
category: 'eating_out',
time: '2018-03-02T10:34:30.000Z'
},
'use strict';
angular.module('App').directive('lazyLoad', function () {
return {
restrict: 'A',
link: function link(scope, element, attrs) {
var options = {
root: document.querySelector('#list'),
rootMargin: '0px',
threshold: 0