Skip to content

Instantly share code, notes, and snippets.

Avatar

palanisamym14

View GitHub Profile
View browsers.json
{
"firefox": {
"default": "57.0",
"versions": {
"57.0": {
"image": "selenoid/firefox:88.0",
"port": "4444",
"path": "/wd/hub"
}
}
View merge.js
/**
* Simple object check.
* @param item
* @returns {boolean}
*/
export function isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
/**
View storybook.js
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"
View ObjectIdScalar.ts
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
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Nest Framework",
"args": [
"${workspaceFolder}/src/main.ts"
],
View graphql-axios.ts
const [path, setPath] = useState({});
useEffect(() => {
if (file.name) {
fetchMyAPI();
}
}, [file.name]);
async function fetchMyAPI() {
const res: any = await getSignedURL(file.name);
setPath(res);
View logger.decorator.ts
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);
View multiselect.tsx
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 Oct 28, 2021
ssh2-sftp-client - Test sftp connection using aws lambda, input should be passed array of object
View lambda_sftp_check.js
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];
}
View search.cob
IDENTIFICATION DIVISION.
PROGRAM-ID. LetterSearch.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LetterTable.
02 LetterValues.
03 FILLER PIC X(13)
VALUE "ABCDCEFGHIJLM".
03 FILLER PIC X(13)
VALUE "NOPQRSTUVWXYZ".