Skip to content

Instantly share code, notes, and snippets.

View sample.json
{
"connection": {
"appUser": "1",
"appPassword": "1",
"queueName": "1",
"port": "1",
"queueManagerName": "1",
"host": "1",
"channel": "1",
"applicationName": "1"
View ssh2-node.js
const fs = require('fs')
const { Client } = require('ssh2');
const run = async () => {
try {
return new Promise((resolve, reject) => {
const conn = new Client();
conn.on('ready', () => {
console.log('Client :: ready');
View readfileLineByLine.js
const fs = require('fs');
const lineReader = require('line-reader');
const mainframeFileName = 'ftc/infolease-23-4-21.txt';
const microserviceFileName = 'ftc/23-4-21-CACS_TO_INFOLEASE';
var counter = 0;
const mainframeLines = await readlinesFromFile(mainframeFileName);
const microserviceLines = await readlinesFromFile(microserviceFileName);
const file1rmsRecords = [];
for (const line of mainframeLines) {
const result = flatFileToObj(
View sample.ts
[].map(itm=> ({...itm, column: itm.column.replace('msaRecord.', '').replace('msaData.','d_').replace('.', '_')}))
const data =[];
let key = 'CREATE TABLE TABLE (', val = 'VALUES(';
data.forEach(itm=>{
switch(itm.type){
case 'string':
key += `${itm.column.toLocaleUpperCase()} VARCHAR(${itm.width}),`;
break;
case 'int':
View test.js
https://teams.microsoft.com/dl/launcher/launcher.html?url=%2F_%23%2Fl%2Fmeetup-join%2F19%3Ameeting_MTFlNjQwNzgtNWUxYi00MzBkLTlhMjAtNDRhMDBkODRhY2Ix%40thread.v2%2F0%3Fcontext%3D%257b%2522Tid%2522%253a%252239b03722-b836-496a-85ec-850f0957ca6b%2522%252c%2522Oid%2522%253a%25226c831103-637c-4b94-b28f-f30d105978a2%2522%257d%26anon%3Dtrue&type=meetup-join&deeplinkId=c7ba078d-cc5a-4c32-b47b-5d6548ed1bd2&directDl=true&msLaunch=true&enableMobilePage=true&suppressPrompt=true
View test.html
const App = props => {
const itemsRef = useRef([]);
// you can access the elements with itemsRef.current[n]
useEffect(() => {
itemsRef.current = itemsRef.current.slice(0, props.items.length);
}, [props.items]);
return props.items.map((item, i) => (
<div
View moment.js
let startDate = moment(date).subtract(1,'M').startOf('month').add(15,'d').format('YYYY-MM-DD')
let endDate = moment(date).subtract(1,'M').startOf('month').add(1,'M').add(14,'d').format('YYYY-MM-DD')
if(moment(date).isSameOrAfter(startDate) && moment(date).isSameOrBefore(endDate)){
console.log(moment(startDate).format('MMM, YYYY'))
}else{
console.log(moment(endDate).format('MMM, YYYY'))
}
View gist:d9965a0b331c8b11def9881aaf8538bc
.select-style {
padding: 0;
margin: 0;
border: 1px solid #ccc;
width: 120px;
border-radius: 3px;
overflow: hidden;
background-color: #fff;
background-size:10px 10px;
background: #fff url("https://image.flaticon.com/icons/svg/892/892498.svg") no-repeat 40% 50%;
View http.js
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"]
}
View queryformater.ts
const query :any= 'select a, b.d,ROW_NUMBER() OVER(ORDER BY col DESC),b.e as f,c as g from const';
const test = (query:any, offset:any,limit:any)=>{
let data:any = query.split('from')[0];
data = data.split('FROM')[0];
let tempQuery:any = data.split(',');
let queryt:any = `${tempQuery[0]}`;