Skip to content

Instantly share code, notes, and snippets.

View jarrodek's full-sized avatar

Paweł Uchida-Psztyć jarrodek

View GitHub Profile
@jarrodek
jarrodek / a11y-suite.js
Created June 23, 2019 01:29
open-wc - accessability test plugin
import { fixture } from '@open-wc/testing';
/* global Mocha, axs */
const Test = Mocha.Test;
const Suite = Mocha.Suite;
export default async (id, html, ignoredRules) => {
const element = await fixture(html);
const mInstancwe = new Mocha();
const suiteInstance = Suite.create(mocha.suite, 'A11y Audit: ' + id);
const axsConfig = new axs.AuditConfiguration();
@jarrodek
jarrodek / commit.js
Created November 9, 2019 02:18
This gist demonstrates how to use nodegit to sign commits using GPG keys.
const nodegit = require('nodegit');
const path = require('path');
const fs = require('fs-extra');
const openpgp = require('openpgp');
const fileName = 'newfile.txt';
const fileContent = 'hello world';
const directoryName = 'salad/toast/strangerinastrangeland/theresnowaythisexists';
/**
* This example creates a certain file `newfile.txt`, adds it to the git
@jarrodek
jarrodek / big-int-parser.js
Last active November 30, 2021 23:02
Parsing a JSON that has a big integer value
/* This is the value that is being parsed. It is defined here because the `reviver` function need the access to it. */
const body = '[{"id":1110746394641760256,"name":"fc1"}]';
/**
* The reviver function passed as a second argument to the JSON.parse() function.
* It transforms the numbers that are above the max integer value into BigInt.
*
* Note 1, BigInt is not the same as a Number. In fact you cannot perform operations on the thwo types.
* Note 2, This won't work when the stringified object has multiple number values that are similar
* (the first 10+ digits are the same, depnding on the value of the `Number.MAX_SAFE_INTEGE`).