Skip to content

Instantly share code, notes, and snippets.

work work

Даниил Пронин Grawl

work work
View GitHub Profile
Grawl /
Last active May 6, 2022
Why you don't have to commit node_modules folder

English | Russian

This note is an answer to questions you can guess reading Jack Franklin blog post.

No need for npm installs

Once you check your node_modules in, there's no need to run an install step before you can get up and running on the codebase

  1. git works bad with a lot of files in repository. You can search “git performance many files” in Google and see a lot of info about this. For example: Just as git does not scale well with large files, it can also become painful to work with when you have a large number of files
Grawl /
Last active May 6, 2022
Почему не надо коммитить папку node_modules

English | Русский

Эта заметка — ответы на вопросы, которые могут возникнуть при чтении статьи Джека Франклина в переводе For Web.

Нет нужды в npm install

Если вы храните node_modules в git, вам не нужно отдельно устанавливать зависимости, чтобы запустить проект.

  1. git плохо работает с большим количеством файлов в репозитории. Поиск фразой “git performance many files” показывает много полезной информации об этом. Например, вот: Just as git does not scale well with large files, it can also become painful to work with when you have a large number of files
Grawl /
Last active Apr 24, 2022
migrate from nvm to asdf


With ASDF, you can manage version of Node, Yarn, PNPM, PHP, Python, and more than 400 other tools, languages and binaries.

  1. Uninstall nvm

  2. Install asdf

  3. Install nodejs plugin for asdf

    Add legacy_version_file = yes to ~/.asdfrc file

  4. Install gnupg

View photoswipe-previews.js
import PhotoSwipe from 'photoswipe/dist/photoswipe'
import PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default'
import { photoswipePreviews } from './previews'
const holder = document.querySelector('.pswp')
// initializing code
const openPhotoSwipe = ({ items }) => {
View uvue-server-plugin-amp.js
import posthtml from 'posthtml'
export default {
async rendered(response, context, app) {
// TODO try to use route meta instead?
if (context.url.endsWith('/amp')) {
const html = response.body
const transform = new TransformHTML(html)
response.body = await transform.transform()
View ImageURLsFromHTML.js
* Return array of URLs found in HTML string
* If `<img>` wrapped into `<a>` uses `[href]` of `<a>` if it's an image
* @param {string} html
* @returns {string[]}
async ImageURLsFromHTML(html) {
try {

SCP-1295-1 - Война - Вильгельм

SCP-1295-2 - Голод - Готфрид

SCP-1295-3 - Мор - Боб

SCP-1295-4 - Смерть - Сэм

<Начало записи>

View util.php
class Util {
* Join paths
* @param
* @return string
public static function PathJoin() {
Grawl /
Created Feb 3, 2020
How to Mock an API with random data from NodeJS

As a frontend developer, you often need data from an API. But sometimes the backend hasn't been set up by your team. In order for you to continue and mock your data, it's a good idea to not store your data structure on memory.

It's a good idea to start as soon as possible to talk with an external API where your data comes from. In this tutorial, I want to go through a minimal setup for mocking your data. After this, you should be able to extend it with your own data as needed.


In order to work with Node you need to have it installed on your machine. For the mac users I highly recommend to install it with NVM, because it will make it easier to update NodeJS in the future. (There is also a version for Windows).

Create a new folder to start for this project. Run npm init -y to initialize the folder with Node and it will create automaticly a package.

Grawl /
Created Aug 10, 2019
Running Webpack Dev Server with HTTPS on developer machine using MKCERT
  1. Add local domain to /etc/hosts:

  2. Install mkcert

  3. Create certificate for this domain:

    ➜ mkcert