Skip to content

Instantly share code, notes, and snippets.

View Grawl's full-sized avatar
🔨
work work

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

🔨
work work
View GitHub Profile
@Grawl
Grawl / nvm-to-asdf-migration.md
Last active April 12, 2024 08:12
migrate from nvm to asdf

TL;DR

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

@Grawl
Grawl / webpack-https-mkcert.md
Created August 10, 2019 06:21
Running Webpack Dev Server with HTTPS on developer machine using MKCERT
  1. Add local domain to /etc/hosts:

    127.0.0.1 my-project.dev

  2. Install mkcert

  3. Create certificate for this domain:

    ➜ mkcert my-project.dev
@Grawl
Grawl / do-not-commit-node_modules-folder.md
Last active June 3, 2023 18:05
Почему не надо коммитить папку 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
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 }) => {
@Grawl
Grawl / input.scss
Created October 31, 2022 05:07
Generated by SassMeister.com.
@for $i from 1 through 300 {
$z: (random(360) * 1deg); // random angle to rotateZ
$y: (random(360) * 1deg); // random to rotateX
$hue: ((40/300 * $i) + 0); // set hue
$orb-size: 100px;
$time: 1s;
circle:nth-child(#{$i}){ // grab the nth particle
animation: orbit#{$i} $time infinite;
animation-delay: ($i * .01s);
@Grawl
Grawl / do-not-commit-node_modules-folder.md
Last active May 6, 2022 05:24
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
Grawl / index.md
Created February 3, 2020 01:10
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.

Dependencies

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.

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()
}
},
/**
* 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 - Смерть - Сэм

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