Skip to content

Instantly share code, notes, and snippets.

View lordgape's full-sized avatar

Chesvic Hillary lordgape

  • Jumia Group
  • Lagos Nigeria
View GitHub Profile
const Formatter = require("./formatter");
const ApiClient = require("./api-client"); // Any API Client implementation. Can be axios
const Parser = require("./parser");
const url = `http://www.dneonline.com/calculator.asmx`;
module.exports = class Remote {
static async multipleTwoOperands(operandA, operandB) {
try {
let payload = {
const Parser = require("./parser");
module.exports = class Formatter {
static convertJsonToSoapRequest(jsonArguments) {
let soapBody = Parser.parseJSONBodyToXML(jsonArguments);
return `<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://tempuri.org/">
<soap:Header/>
<soap:Body>
${soapBody}
const jsonxml = require("jsontoxml");
const parseString = require("xml2js").parseString;
const { promisify } = require("util");
const promisfiedParseString = promisify(parseString);
module.exports = class Parser {
static parseJSONBodyToXML(jsonArgument) {
return jsonxml(jsonArgument, { html: true });
}
@lordgape
lordgape / parser.js
Created March 15, 2021 20:14
A node utility class to convert xml to json and vice versa. Depends on xml2js and jsontoxml node package
const jsonxml = require("jsontoxml");
const parseString = require("xml2js").parseString;
const { promisify } = require("util");
const promisfiedParseString = promisify(parseString);
module.exports = class Parser {
static parseJSONBodyToXML(jsonArgument) {
return jsonxml(jsonArgument, { html: true });
}
@lordgape
lordgape / HeidiDecode.js
Created March 6, 2020 20:03 — forked from jpatters/HeidiDecode.js
Decodes a password from HeidiSQL. HeidiSQL passwords can be found in the registry. Use File -> Export Settings to dump all settings. Great for if you forget a password.
function heidiDecode(hex) {
var str = '';
var shift = parseInt(hex.substr(-1));
hex = hex.substr(0, hex.length - 1);
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
return str;
}
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393'));
@lordgape
lordgape / snippet.js
Created April 18, 2019 13:45
Add Filters and Sort Feature to your search API
validateFilterAndSort(req,res,next)
{
let query = req.query['q'];
// Let destructure our query.
let {filter,sort} = req.query;
// Let's limit the possible column user can filter by.
@lordgape
lordgape / Usercomponent.vue
Last active April 18, 2019 13:46
Bootstrap User Component in Vue js
<template>
<div class="container">
<div class="row mt-5">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Users</h3>
<div class="card-tools">