Skip to content

Instantly share code, notes, and snippets.

View palanisamym14's full-sized avatar

palanisamym14

View GitHub Profile
[
[
[
{
"id": 1,
"title": "row 1"
}
]
],
[
{
"firefox": {
"default": "57.0",
"versions": {
"57.0": {
"image": "selenoid/firefox:88.0",
"port": "4444",
"path": "/wd/hub"
}
}
/**
* Simple object check.
* @param item
* @returns {boolean}
*/
export function isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
/**
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app"
@palanisamym14
palanisamym14 / ObjectIdScalar.ts
Created December 31, 2021 10:31
nest object scalar
import { Scalar, CustomScalar } from '@nestjs/graphql';
import { Kind, ValueNode } from 'graphql';
import { ObjectId } from 'mongodb';
@Scalar('ObjectId')
export class ObjectIdScalar implements CustomScalar<string, ObjectId> {
description = '`Date`';
parseLiteral(ast): ObjectId {
// check the type of received value
@palanisamym14
palanisamym14 / launch.json
Created December 29, 2021 09:33
nestjs launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Nest Framework",
"args": [
"${workspaceFolder}/src/main.ts"
],
const [path, setPath] = useState({});
useEffect(() => {
if (file.name) {
fetchMyAPI();
}
}, [file.name]);
async function fetchMyAPI() {
const res: any = await getSignedURL(file.name);
setPath(res);
function log(target:any, name:any, descriptor:any) {
const original = descriptor.value;
if (typeof original === 'function') {
descriptor.value = function(...args: any) {
console.log("Logged at: " + new Date().toLocaleString());
console.log(args);
console.log(name);
console.log(target);
try {
const result = original.apply(this, args);
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
import classNames from 'classnames';
import Icon from '../../Icon';
import { filter, find, remove } from 'lodash';
import { usePopper } from 'react-popper';
export type OptionProps = {
label?: string;
value?: string;
};
@palanisamym14
palanisamym14 / lambda_sftp_check.js
Last active October 28, 2021 04:19
ssh2-sftp-client - Test sftp connection using aws lambda, input should be passed array of object
const AWS = require('aws-sdk');
const SSM = new AWS.SSM();
const fs = require('fs');
let Client = require('ssh2-sftp-client');
function clean(obj) {
for (var propName in obj) {
if (obj[propName] === null || obj[propName] === undefined) {
delete obj[propName];
}