Skip to content

Instantly share code, notes, and snippets.

View ArturJS's full-sized avatar
🎯
Focusing

Artur ArturJS

🎯
Focusing
View GitHub Profile
@ArturJS
ArturJS / GIT_BISECT.md
Last active September 24, 2025 14:10
How to use git bisect

Git Bisect - Простая инструкция

git bisect - это мощный инструмент, который помогает найти точный коммит, где была введена ошибка, используя бинарный поиск.

Шаги по использованию git bisect:

  1. Запустите процесс bisect:
    git bisect start
@ArturJS
ArturJS / css_colors_extractor.js
Created June 8, 2025 17:52
CSS colors extractor
import * as fs from 'fs';
import * as path from 'path';
const cssDir = 'src';
const outputFile = 'src/vars.css';
const hexRegex = /#([a-fA-F0-9]{3,6})/g;
const rgbRegex = /rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)/g;
const rgbaRegex = /rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*\d*\.?\d+\s*\)/g;
@ArturJS
ArturJS / sorry-cypress-create-project.sh
Created September 17, 2022 04:25
Sorry cypress create project
# Sometimes when you run sorry-cypress
# and have misconfigured UI which has
# http://localhost:4000 as baseUrl for API backend
# and need to create new project ASAP
# without digging into docs and sources
curl 'http://<your_ip_address>:4000/' \
-H 'sec-ch-ua: "Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"' \
-H 'accept: */*' \
-H 'Referer: http://<your_ip_address>:8080/' \
@ArturJS
ArturJS / hash-router.js
Last active December 22, 2021 08:45
Js hash router
class Router {
constructor({
pages,
rootSelector
}) {
this.pages = pages;
this.rootSelector = rootSelector;
this.initRouting();
}
@ArturJS
ArturJS / getImageType.js
Created March 22, 2021 17:52
getImageType.js from @tensorflow/tfjs-node/dist/image.js
/**
* Helper function to get image type based on starting bytes of the image file.
*/
function getImageType(content) {
// Classify the contents of a file based on starting bytes (aka magic number:
// https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files)
// This aligns with TensorFlow Core code:
// https://github.com/tensorflow/tensorflow/blob/4213d5c1bd921f8d5b7b2dc4bbf1eea78d0b5258/tensorflow/core/kernels/decode_image_op.cc#L44
if (content.length > 3 && content[0] === 255 && content[1] === 216 &&
content[2] === 255) {
  1. Get node binary (node.exe) from http://nodejs.org/download/
  2. Create the folder where node will reside and move node.exe to it
  3. Download the last zip version of npm from http://nodejs.org/dist/npm
  4. Unpack the zip inside the node folder
  5. Download the last tgz version of npm from http://nodejs.org/dist/npm
  6. Open the tgz file and unpack only the file bin/npm (without extension) directly on the node folder.
  7. Add the the node folder and the packages/bin folder to PATH
  8. On a command prompt execute npm install -g npm to update npm to the latest version

Now you can use npm and node from windows cmd or from bash shell like Git Bash of msysgit.

@ArturJS
ArturJS / stash_dropped.md
Created February 19, 2020 08:43 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@ArturJS
ArturJS / server.ts
Created February 5, 2020 07:44
Deno server
import { serve } from "https://deno.land/[email protected]/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
req.respond({ body: "Hello World\n" });
}
@ArturJS
ArturJS / headless.md
Created January 28, 2020 11:44 — forked from addyosmani/headless.md
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.