Skip to content

Instantly share code, notes, and snippets.

View cvaize's full-sized avatar

Орлов Дмитрий cvaize

  • Batyukov Studio
View GitHub Profile
@cvaize
cvaize / html.go
Last active March 31, 2026 03:42
A Golang function that generates an array of numbers for pagination, from which you can create an array of links for pagination and print the pagination template.
package html
import (
"html/template"
"project/resources/views"
"slices"
"strings"
)
type Html = *template.Template
@cvaize
cvaize / main.go
Last active January 8, 2026 10:03
Replace rem to px into .css files with math.Round
package main
import (
"fmt"
"io/fs"
"math"
"os"
"path/filepath"
"regexp"
"strconv"
@cvaize
cvaize / main.rs
Created December 14, 2025 13:57
Fix music cue files
#![feature(trim_prefix_suffix)]
use std::borrow::Cow;
use walkdir::WalkDir;
use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;
use chardetng::EncodingDetector;
use encoding_rs::WINDOWS_1251;
use encoding_rs::WINDOWS_1252;
@cvaize
cvaize / index.js
Last active November 20, 2024 05:37
Скрипт получения не стилизованных классов из html, для последующего копирования и стилизации
fetch('/shop-front-template-1/public/css/app.css').then(t => t.text()).then(css => {
let classes = {};
let elements = Array.from(document.querySelectorAll('*'));
for (let i = 0; i < elements.length; i++) {
let element = elements[i]
let classes_ = Array.from(element.classList);
for (let j = 0; j < classes_.length; j++) {
classes[classes_[j]] = true;
}
}
@cvaize
cvaize / bootstrap-4.blade.php
Last active October 13, 2022 19:06
Laravel pagination on lg( @media( >= 480px) ) screens onEachSide(5) and on xs( @media( < 480px) ) screens onEachSide(1)
@if ($paginator->hasPages())
<?php
if (sizeof($elements[0]) === 2) {
unset($elements[0][array_key_last($elements[0])]);
}
if (sizeof($elements[4]) === 2) {
unset($elements[4][array_key_first($elements[4])]);
}
?>