Skip to content

Instantly share code, notes, and snippets.

View Pustelto's full-sized avatar

Tomas Pustelnik Pustelto

View GitHub Profile
@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active July 24, 2024 12:04
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@musatov
musatov / monoRepoTotalCoverage.js
Created May 20, 2023 14:47
This script automates code coverage reports in a monorepo setup using Jest and Turborepo. It collects and merges data from each package, providing a holistic view of code quality. Assumes a setup with each package outputting coverage data in a 'coverage' folder.
const fs = require('fs')
const path = require('path')
// Params
const pathToPreviousReport = process.argv[2]
// Functions
/**
* Reads the coverage-summary.{XXX}.json file and returns the parsed JSON object
* @param {*} pathToReport
* @returns
@kentcdodds
kentcdodds / index.js
Created July 9, 2021 21:40
Parsing HTML or Markdown and processing both as markdown then outputting to HTML
const unified = require('unified')
const parseMarkdown = require('remark-parse')
const parseHtml = require('rehype-parse')
const remark2rehype = require('remark-rehype')
const rehype2remark = require('rehype-remark')
const rehypeStringify = require('rehype-stringify')
const visit = require('unist-util-visit')
async function go() {
const inputString = `
@tkadlec
tkadlec / perf-diagnostics.css
Last active June 8, 2023 17:47
CSS used to highlight potential performance issues
:root {
--violation-color: red; /* used for clear issues */
--warning-color: orange; /* used for potential issues we should look into */
}
/* IMAGES */
/*
* Lazy-Loaded Images Check
* ====
@kamranayub
kamranayub / next.config.js
Last active September 20, 2023 20:45
React Production Profiling Support for Next.js
//
// See: https://kentcdodds.com/blog/profile-a-react-app-for-performance#build-and-measure-the-production-app
// See: https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config
const TerserPlugin = require('next/dist/compiled/terser-webpack-plugin');
module.exports = {
webpack: (config, options) => {
//
// Use profiler-enabled React builds
@jamesknelson
jamesknelson / README.md
Last active August 20, 2022 22:21
Convert a video into a gif

A 4-line shell script to convert your movies into gifs. Defaults to 10fps, 700px wide.

WIDTH=420 FPS=12 togif input.mov

You'll need to have ffmpeg installed -- on mac, you can do this with brew:

brew install ffmpeg
@mrVanboy
mrVanboy / codeclimate-to-markdown.md
Last active January 10, 2024 11:58
Markdown table from code-climate.json with jq

Example of the creating markdown table from the gl-code-quality-report.json Gitlab's code quality report with codeclimate SPEC.

  1. Install jq
  2. Run the next command to convert gl-code-quality-report.json to markdown:
    jq -r '. | sort_by((.location.path | explode | map(-.)), .location.lines.begin) | .[] | @text "| [\(.location.path):\(.location.lines.begin)](../blob/BRANCH-NAME/\(.location.path)#L\(.location.lines.begin)) | \(.description)"' gl-code-quality-report.json
  3. Add table header to the beggigning of the output:

| Path | Description |

@ebidel
ebidel / coverage.js
Last active April 27, 2024 04:13
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@novascreen
novascreen / README.md
Last active November 18, 2021 08:11
How to mock next/router in Storybook

If you use Storybook with Next.js and have components using next/link you'll have to mock next/router the same you would for testing with Jest or others. Simply create a file with the mock router as shown below and import it in your Storybook config.

This is based on some information from an issue on Next.js:

vercel/next.js#1827

@jvorcak
jvorcak / tig.md
Last active October 11, 2019 17:24
tig - Text-mode interface for git

tig - Text-mode interface for git

This is a proposal for #ReactiveConf 2017 open call for Lightning talks.


Do you think that using git command line tool is the most efficient way of interacting with your repository? In this lightning talk, I will introduce tig - the ncurses front-end for git, which will make your interaction with git much more efficient.

tig combines the advantages of the command line and GUI tools like qgit. With a couple of keystrokes, you are