Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
d1i1m1o1n / test.js
Created June 27, 2024 09:41
A simple way to create a helper to wait for a specified time. It can be useful for simulation of server response and other purposes during development.
const wait = async (milliseconds) => new Promise(
(resolve) => setTimeout(resolve, milliseconds)
);
wait(2000).then(doSomthing);
@d1i1m1o1n
d1i1m1o1n / docker-local-dev-frontend.md
Last active January 31, 2024 16:29
Local launch of frontend application via docker in development mode

Dockerfile

FROM node:16-alpine AS development
ENV NODE_ENV development
# Add a work directory
WORKDIR /app
# Cache and Install dependencies
COPY package.json .
COPY package-lock.json .
RUN npm install --force
@d1i1m1o1n
d1i1m1o1n / style.css
Created June 14, 2021 12:05
We can use CSS aspect-ratio today by using CSS @supports and CSS variables.
.card {
--aspect-ratio: 16/9;
padding-top: calc((1 / (var(--aspect-ratio))) * 100%);
}
@supports (aspect-ratio: 1) {
.card {
aspect-ratio: var(--aspect-ratio);
padding-top: initial;
}
@d1i1m1o1n
d1i1m1o1n / switch.js
Created February 27, 2021 10:15
Alternative to switch case
const page = 'edit';
const content = {
create: () => console.log('create'),
edit: () => console.log('edit'),
view: () => console.log('view')
}[page]()
@d1i1m1o1n
d1i1m1o1n / test.blade.php
Created December 4, 2020 15:36
Laravel blade debug
@dd($test->toArray())
@d1i1m1o1n
d1i1m1o1n / migrate.sh
Created February 18, 2020 12:21
Migrate a database with seeds using Laravel
#!/bin/bash
rm -f database/migrations/*.php || echo OK
cp database/migrations/m/*.php database/migrations/
php artisan migrate:refresh
php artisan db:seed
rm -f database/migrations/*.php || echo OK

Keybase proof

I hereby claim:

  • I am d1i1m1o1n on github.
  • I am d1i1m1o1n (https://keybase.io/d1i1m1o1n) on keybase.
  • I have a public key ASCusgdyVIMdPfuc1tmYsNLIeC6PRArFeq4Sh7ilTUhLMQo

To claim this, I am signing this object:

@d1i1m1o1n
d1i1m1o1n / style.css
Created August 26, 2019 16:08
Full viewport width image (container) inside article
.full-width {
width: 100vw;
position: relative;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
}
@d1i1m1o1n
d1i1m1o1n / style.css
Created June 21, 2019 05:09
visually hidden
.visually-hidden {
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
}
@d1i1m1o1n
d1i1m1o1n / header.pug
Created February 23, 2018 21:12 — forked from lineharo/header.pug
PUG - auto version .css or another files in HTML head
- function pDate() {
- return new Date().getTime();
- }
doctype html
html(lang="ru")
head
meta(charset="utf-8")
title TITLE