Skip to content

Instantly share code, notes, and snippets.

View skimi's full-sized avatar

Rémi Gebski skimi

View GitHub Profile
@skimi
skimi / $regeneratePollyjsRecordId.js
Last active February 16, 2021 09:58
Dirty script to regenerate PollyJS record id after a manual edit
// This is a dirty hack of pollyJS to regenerate the har ids so we can modify
// a file by hand and just run this script
// The script executes like this: `find your-recordings-path -name "*.har" | xargs node scripts/regenerateRecordId`
// or `node scripts/regenerateRecordId your-folder/your-recording.har`
// But read the comments below. This is might not work anymore, it requires a lot of copy/paste & maintenance if pollyJS changes
const keys = require('lodash/keys');
const fs = require('fs');
// These are extracted from a project using pollyJS in Cypress
// They might not work, I've just copy/pastied what I thought was relevant and removed lines of codes specific to the project
const pollyConnect = (
win,
{ mocks, mode, pollyName },
) => {
console.log(
`%cInit polly ${pollyName} for location ${win.location}`,
'background: gray; color: white; padding: 5px',
@skimi
skimi / analysis-har-network.js
Created January 21, 2020 09:57
analysis-har-network.js
const fs = require('fs');
const groupBy = require('lodash/groupBy');
const filePath = process.argv[2];
const file = JSON.parse(fs.readFileSync(filePath, 'utf8'));
const files = file.log.entries.map((entry) => {
const url = new URL(entry.request.url);
@skimi
skimi / changeForCash.js
Last active September 19, 2019 20:42
Calculate minimal change for cash
var change = (cash) => {
var bills = [2, 5, 10];
var change = bills.reduce((carry, bill) => {
carry[bill] = 0;
return carry;
}, {});
var remaining = cash;
bills.forEach((bill, index) => {
if (index === bills.length - 1) {
@skimi
skimi / close_remove_service.md
Last active September 7, 2017 14:57
Workflow conflict management

Close a service

  • In reservation list click on "close service"
  • We close a service by creating a new service with parentUuid of the service we want to close (with empty tags)
post /restaurants/{restaurantId}/services 
  => tags: []
  => dateRanges : {
    start: closedDate,
    end: closedDate,
  }