Skip to content

Instantly share code, notes, and snippets.

View Tomas2D's full-sized avatar
:octocat:

Tomáš Dvořák Tomas2D

:octocat:
View GitHub Profile
@Tomas2D
Tomas2D / puppeteer-wait-network-xhr.ts
Last active July 5, 2022 15:05
Puppeteer wait for XHR calls
View puppeteer-wait-network-xhr.ts
function waitForAjaxCalls(page: Page) {
const task = new Task<void>();
let _expectedCount = Infinity;
let processedCalls = 0;
const handler = (req: HTTPRequest) => {
if (req.method() !== 'POST') {
return;
}
@Tomas2D
Tomas2D / fast-sparql-query.html
Created April 25, 2022 19:52
Fast and slow SPARQl query
View fast-sparql-query.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="Copyright" content="Copyright &#169; 2022 OpenLink Software" />
<meta name="Keywords" content="OpenLink Virtuoso Sparql" />
<title>Virtuoso SPARQL Compilation report</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" integrity="sha512-P5MgMn1jBN01asBgU0z60Qk4QxiXo86+wlFahKrsQf37c9cro517WzVSPPV1tDKzhku2iJ2FVgL67wG03SGnNA==" crossorigin="anonymous" />
@Tomas2D
Tomas2D / i18n.types.ts
Last active January 11, 2022 11:40
Type-safety for JSON translations (TypeScript)
View i18n.types.ts
import * as error from './cs/error.json';
/*
// Content of a "./cs/error.json" file
{
"general": {
"unexpected": "Došlo k neočekávané chybě."
},
"unauthorized": {
"token": "Váš přístup byl zamítnut, nevalidní token."
}
View Bypass Google reCaptcha - JS example.js
// API key
// https://2captcha.com/enterpage
const API_KEY = "XXXX";
// Find site key of a website
const googleSiteKey = document
.getElementsByClassName("g-recaptcha")[0]
.getAttribute("data-sitekey");
// Helper parsing function