This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******** | |
* This module will help us decouple alot of functionality like | |
* * sending emails | |
* * sending sms | |
* * sending notification | |
* * tracking users activities | |
* | |
*/ | |
import * as events from "events" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FilterQuery<T> = { | |
[K in keyof T]?: T[K] | |
}; | |
static async findOne(field: FilterQuery<ITranslation>): Promise<any> { | |
try { | |
const results = await this.builder().where(Object.keys(field)[0], "==", Object.values(field)[0]).get(); | |
if (results.length) { | |
return results[0]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AxiosResponse } from "axios"; | |
import { AxiosConfig } from "../../api"; | |
export interface IRead<T> { | |
getAll(route: string, params?: string): Promise<AxiosResponse<T[]>>; | |
getById(route: string, id: string): Promise<AxiosResponse<T>>; | |
getPaginatedList(route: string, params?: string): Promise<AxiosResponse<T[]>>; | |
} | |
export interface IWrite<T> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfoutput> | |
#hash("Password1!", "SHA-512", "UTF-8")# | |
</cfoutput> | |
# output - ECB3548B49FEFA9C984EC134FA362B3316EC8CC4C044B3A71444EED538ECC39461FE5D4DD1D71287FCD2B1C3354CC36873956B3E15229B5ACBDACDA276BABED1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const osbEncryption = (str: string | Record<string, any>) => { | |
console.log("STRING",str) | |
const reverseString = str.split("").reverse().join("") | |
console.log("REVERSE STRING", reverseString) | |
let hmac = crypto.createHash("sha512"); | |
hmac.update(typeof reverseString === 'string' ? reverseString : JSON.stringify(reverseString)); | |
return Buffer.from(hmac.digest()).toString('hex') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Rules for MONGODB Multi Document Transactions | |
* All data modeling rules still applies | |
* Transactions should be the most common operation | |
* Pass in the session to all statements | |
* Implement retry logic , transactions can always abort | |
* Plan for DDL operations | |
*/ | |
import db, { ClientSession } from 'mongoose'; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from functools import reduce | |
class Calculator: | |
def __init__(self): | |
pass | |
def __str__(self): | |
return "Basic calculator" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.9.0; | |
import './BCShopSeller.sol'; | |
import './BCShopCourier.sol'; | |
contract BCShopBuyer { | |
address payable sellerAddress; | |
SellerInterface SellerContract; | |
CourierInterface CourierContract; | |
constructor(address payable _sellerAddress, address courierAddress) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const BCShopCourier = artifacts.require("BCShopCourier"); | |
const BCShopSeller = artifacts.require("BCShopSeller"); | |
const BCShopBuyer = artifacts.require("BCShopSeller"); | |
module.exports = async(deployer) => { | |
let deployBCShopCourier = await deployer.deploy(BCShopCourier) | |
.then(async(courier) => { | |
// console.log(data) | |
let deployBCShopSeller = await deployer.deploy(BCShopSeller, courier.address) | |
.then(async(seller) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.9.0; | |
import './BCShopCourier.sol'; | |
interface SellerInterface{ | |
function addSale(uint256 productID) external; | |
function buyerReceiveProduct(uint256 saleID)external; | |
function getProductPrice(uint256 productID) external view returns(uint256 price); | |
function getSaleStatus(uint256 saleID) external view returns(string memory status); | |
} |