Skip to content

Instantly share code, notes, and snippets.

View lukasbach's full-sized avatar
🦕

Lukas Bach lukasbach

🦕
View GitHub Profile
@lukasbach
lukasbach / code.js
Created February 23, 2023 01:42
Generate Github API Graphql Query for fetching all file contents in a repo
const owner = "lukasbach";
const repo = "react-complex-tree";
const branch = "main";
(async () => {
const trees = (await (await fetch(`https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`)).json()).tree;
const folders = trees.filter(i => i.type === "tree").map(i => i.path);
const queries = folders.map(folder => `
${folder.replace(/[^a-zA-Z0-9]/g, "_")}: object(expression: "${branch}:${folder}") {
... on Tree {
@lukasbach
lukasbach / deploy.yml
Created November 15, 2022 11:01
Thesis Deployment
name: Deploy PDF
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
@lukasbach
lukasbach / index.html
Last active October 11, 2022 10:04
Electron desktopCapturer.getSources demo. To reproduce, install Electron Fiddle (https://www.electronjs.org/fiddle) and load the gist there.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>
@lukasbach
lukasbach / content.md
Created August 9, 2022 09:06
markdown example

Advertisement :)

  • pica - high quality and fast image resize in browser.
  • babelfish - developer friendly i18n with plurals support and easy syntax.

You will like those projects!

@lukasbach
lukasbach / recipes.ts
Last active March 23, 2022 21:49
TypeScript Advanced typing recipes
type Wrapper<T> = { wrapped: T };
type MapObject<T extends Record<keyof Object, any>> = {
[K in keyof T]: Wrapper<T[K]>;
};
type MapTuple<T extends [...any[]]> = {
[I in keyof T]: Wrapper<T[I]>;
} & { length: T["length"] };
@lukasbach
lukasbach / book
Created February 12, 2022 23:38
Factorio Modular Traingrid Blueprint Library
This file has been truncated, but you can view the full file.
0eNrMvVtvXcmSnftXCnoWjZn3zA34we6DAxiwAcMNAzYawgarxKpNbJYoU1R192ns/34WKV7mEjNXji9yabcfGt2t4hozMy55iYiM8W/vfr75evX57vrT/Z9/vr3967s//dvrv3x596d/+jfwBw//7fqX20/f/vnL9W+fLm8e/u3+Xz9fvfvTu+v7q9/fvX/36fL3h//v7vL65t3f3r+7/vTx6l/e/cn97f30J1/uL3/568Wv1zf3V3cX15++XN0d/o8dhv/bh/fvrj7dX99fX30bw+P/869//vT1958Pf/kn9wJ19S+f766+fLn4evjl3W93t4f/ffHz1c394WOfb78cAG4/PQzjABr+Q3r/7l/f/amU/5AOn/p4fXf1y7f/nN8/D/P26/3nr/fvHqbw3Rf9my/e311++vL59u5+8D0//l4HP6zMKFtmFO0zysqM0hv8L59vru8fNP0GOT4j1zluxuNOSBMF42eEX+34b+QeO/gN4xekV7cBxdZXwfSgLH7cBKu//jQweufB4J17UawgFosHu01YlMaTiUufNK0aLmHzcmwldHnhC5oFcxd3gX2hEjPLp52EO7SLaLR+419I7AsWR3dlxdM98vQKPN0HLq6GXMDHhS9oCuFu7Df2Be7G3rEvFKDhB6WdcDLPd2XPFh3fyGgTOBAF7r6+sMOp419gh6JAvPVhwid0Gbh/+spGGxe+IB3igsE/2QoQsmFJfjH5ajk7BL7vhuEHu1Kr9g80SWjNfmmSPhC5L8fhB3zvA85+fWp9f4veDlkloQT7laYOxhzttzBNzsk+5pGc+Y5aZ2LgHtmY6qp9zJqcm30GAzknw3HYoUEn03HYLS2+yS9dFqvhCJ7Cwk1uYLEpLmCOFJ4W7oOawvPCHW406rJwa9NGXRdGXaUvtIU5DCwkG9w3zzDdAuZAf9kv3YktDplXbq6jaazcVUfiNjgk2zay5fTr6tIKnMvCjXgk/bpwj9ck1RZGLS0CxXB/DRMLKm4BcyDr4hdiBJKsS1j
@lukasbach
lukasbach / reference.bib
Created April 1, 2021 15:05
t-Distribution Table LaTeX Code
@article{howell,
author = {Howell, D},
title = {{Fundamental Statistics For the Behavioral Sciences}},
year = {2008}
}
@lukasbach
lukasbach / formatTimeZoneOffset.ts
Created April 14, 2020 13:46
Format Timezone Offset
const formatTimeZoneOffset = (offset: number) => {
return (
(offset >= 0 ? '+' : '-') +
('0' + Math.floor(Math.abs(offset))).slice(-2) +
':' +
('0' + Math.round((Math.abs(offset) % 1) * 60)).slice(-2)
);
};
const removeDuplicates<T> = (arr: T[], equal: (a: T, b: T) => boolean) =>
arr.filter((item, pos) => arr.indexOf(arr.find(inner => equal(inner, item)) === pos));
{
standalone:true,
src_folders:[
'__nightwatch__/testOrchestration'
],
output_folder:'reports',
custom_assertions_path:'',
page_objects_path:'__nightwatch__/pageObjects',
globals_path:'',
selenium:{