Skip to content

Instantly share code, notes, and snippets.

@PawDevUK
PawDevUK / env.txt
Created May 11, 2022 19:04
Portfolio-Server-ENV
VISITORS_URI = mongodb+srv://Troll:[email protected]/Portfolio?retryWrites=true&w=majority
@PawDevUK
PawDevUK / SSH.md
Last active October 19, 2021 09:05

If there is a problem with ssh and despite fact that ssh is configured "permission promlem" comes out try to run bellow command:

ssh-agent -s
ssh-add ~/.ssh/id_rsa
@PawDevUK
PawDevUK / JSON.txt
Last active September 23, 2021 21:55
Methods used with Json
JSON.parse() - converts json object into javascript object
JSON.parse() - converts javascript object into json object
@PawDevUK
PawDevUK / utils.js
Last active September 28, 2021 14:48
UTILS
replaceQuotationMarks(content) {
let replacement = {
""":'"',
""":'"',
"'":"'",
"'":"'"
}
if ( Object.keys(replacement).map( item =>
content.includes(item)
)){
@PawDevUK
PawDevUK / Azure.md
Last active October 19, 2021 09:00
Azure Cli
Deploying

func azure functionapp publish TescoSharePoint --javascript --publish-settings-only, -o - Deploys only local.setting.js to azure portal via azure CLI where --javascript describes environment.
func azure functionapp publish TescoSharePoint --javascript - Deploy cloud function to portal without local.settings.json

var axios = require('axios').default;
var qs = require('qs');
var options = {
method: 'POST',
url: '',
headers: {
cookie: 'fpc=ArTFiOPNPIFFlPNbhNqGpRrzEHueAQAAAH3DndgOAAAA; esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrQWi1S_kz74vM8SLurovqdECNMqdXKsFlLRa4IG3XZ-RacqzlQH6w2fl4bXqFj9sD_AXQ7DRwdHtPqTfBSMw3VAb5rgy0qQsH5InyS21xD8oEdOJ45J2JY-UdYJnli2hDDBTv0gf5jFf_19sGfNAg8yPnTdYWcRi1GHvE7PyV5C0gAA; x-ms-gateway-slice=estsfd; stsservicecookie=estsfd',
'Content-Type': 'application/x-www-form-urlencoded',
},

POST https://{{env.CREATE_TICKET_URL}}

Headers

{
  'Content-Type': 'application/json'
}

Body

@PawDevUK
PawDevUK / Selector.md
Last active July 13, 2021 13:26
Creating Selectors in the widget

In the mapStateToProps function of both BotResponseContainer and UserQueryContainer, you referenced the bot-accessibility parameter directly from the redux state, we don't reference parameters directly because we use selectors that compile multiple sources of config into a single object (for example div params, custom param JSON, etc.). Therefore can you do the following:

  1. Create a new file accessibilitySelector.js within the selector's folder

  2. Create a selector called accessibilitySelector that returns an object with a key-value pair of enabled which is a boolean that represents the bot-accessibility param (don't forget to use the booleanString` function).

  3. Reference accessibilitySelector in both BotResponseContainer and UserQueryContainer by writing accessibility: accessibilitySelector(state)

  4. Update any locations where you previously mentioned accessibility to now be accessibility.enabled`

@PawDevUK
PawDevUK / MR.md
Last active June 29, 2021 20:06
MR description boiler plate

Topic.

Explanation of the work was done and valuable info



Steps to track the problem:
Set environment to recreate the problem:

Description/NO

@PawDevUK
PawDevUK / Jest.md
Last active June 30, 2021 10:51
Testing elements and content with use of testing library Jest

Jest

To test elements and content in javascript files, you can use testing library JEST it is small and ease to use testing lib. To use Jest with React additionally we need add ENZYME

install

To install Jest, run command npm install --save-dev jest
To install Enzyme for React 16 and less, run command npm i --save-dev enzyme enzyme-adapter-react-16
For react v17 need be installed @wojtekmaj/enzyme-adapter-react-17' and then create in root directory setupTests.js with content: