Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
d1i1m1o1n / style.css
Created Jun 14, 2021
We can use CSS aspect-ratio today by using CSS @supports and CSS variables.
View style.css
.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 Feb 27, 2021
Alternative to switch case
View switch.js
const page = 'edit';
const content = {
create: () => console.log('create'),
edit: () => console.log('edit'),
view: () => console.log('view')
}[page]()
@d1i1m1o1n
d1i1m1o1n / test.blade.php
Created Dec 4, 2020
Laravel blade debug
View test.blade.php
@dd($test->toArray())
@d1i1m1o1n
d1i1m1o1n / migrate.sh
Created Feb 18, 2020
Migrate a database with seeds using Laravel
View migrate.sh
#!/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
View keybase.md

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 Aug 26, 2019
Full viewport width image (container) inside article
View style.css
.full-width {
width: 100vw;
position: relative;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
}
@d1i1m1o1n
d1i1m1o1n / style.css
Created Jun 21, 2019
visually hidden
View style.css
.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 Feb 23, 2018 — forked from lineharo/header.pug
PUG - auto version .css or another files in HTML head
View header.pug
- function pDate() {
- return new Date().getTime();
- }
doctype html
html(lang="ru")
head
meta(charset="utf-8")
title TITLE
@d1i1m1o1n
d1i1m1o1n / good-enough.css
Created Jan 6, 2017
CSS body font-family
View good-enough.css
body {
color: #212121;
font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: 0.02em;
}
@d1i1m1o1n
d1i1m1o1n / TimeWeb - SSH RSA Key
Created Nov 9, 2016 — forked from zetrider/TimeWeb - SSH RSA Key
Авторизация SSH по RSA ключу - TimeWeb
View TimeWeb - SSH RSA Key
user - имя пользователя
server.timeweb.ru - сервер
1. На машине ssh-keygen -t rsa
2. Копируем, можно по FTP или одной из команд
2.1. ssh-copy-id -i ~/.ssh/id_rsa user@server.timeweb.ru
2.2. scp ~/.ssh/id_rsa.pub user@server.timeweb.ru:~
3. На сервере
[ -d ~/.ssh ] || (mkdir ~/.ssh; chmod 711 ~/.ssh) # создание директории и изменение прав
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys # добавление открытого ключа