Skip to content

Instantly share code, notes, and snippets.

View Piterden's full-sized avatar
🇷🇺
Stand with Russia!

Denis Efremov Piterden

🇷🇺
Stand with Russia!
View GitHub Profile
@Piterden
Piterden / suggestions.md
Created November 8, 2023 12:43
СБОРНИК рекомендаций

Двигайся, стреляй, общайся

СБОРНИК рекомендаций участникам специальной военной операции (на основе боевого опыта)

ВЕРСИЯ 4.0

I. Подготовка к боевым действиям.

1.

Изучай неприятеля, его сильные и слабые стороны. Недооценивай себя и переоценивай его. Скрупулёзно собирай информацию о тактике действий и вооружении, важны любые мелочи и детали. На разных направлениях они могут различаться. Полученная информация будет способствовать пониманию его возможностей и прогнозированию хода дальнейших действий.

@Piterden
Piterden / onefile.js
Created January 11, 2023 00:35
NodeJS Minesweeper for terminal. No deps. One file.
const { randomInt } = require('crypto')
const readlinePromises = require('readline/promises')
class Square {
open = false
flag = false
bomb = false
value = 0
constructor (col, row) {
const count = 10e6
const length = 100
console.time('generate')
const chars = Array(52).fill().map((_, i) => String.fromCharCode(i < 26 ? i + 65 : i + 71))
const char = () => chars[Math.random() * chars.length | 0]
const triplets = chars.flatMap(a => chars.flatMap(b => chars.flatMap(c => [a, b, c].join(''))))
const triplet = () => triplets[Math.random() * triplets.length | 0]
const main = Array(Math.floor(length / 3)).fill(0)
const tail = Array(length - main.length * 3).fill(0)
@Piterden
Piterden / calendar.js
Created January 28, 2022 17:17
Vue calendar
(function(Vue, $, window, document, undefined) {
Vue.config.devtools = true;
var calendarEventModal = {
template: '#calendar-event-modal',
computed: {
show: function() {
return this.$parent.showModal;
}
@Piterden
Piterden / layout.kbd.json
Last active July 21, 2021 18:28 — forked from bobbicodes/layout.kbd.json
Untitled Keyboard Layout
[
[
["esc", "1", "2", "3", "/", "\\", "fn","del"],
[ "⇥", "4", "5", "6", "[", "]", "'", "⇦"],
[ "`", "7", "8", "9", "0", "-", "=", ";"],
[ "q", "j", "l", "m", "f", "y", "p", "↩"],
[ "z", ".", "o", "r", "s", "u", "c", "b"],
[ "x", "a", "e", "h", "t", "d", "g", "k"],
[ "↥", ",", "i", "n", "w", "v", "↑", "↥"],
["ctr","sup","alt", " ", " ", "←", "↓", "→"]
@Piterden
Piterden / Gibraltar2019.txt
Created December 3, 2020 05:50
Parse chess games to tests
[Event "Gibraltar Masters 2019"]
[Site "Caleta ENG"]
[Date "2019.01.22"]
[Round "1.62"]
[White "Puranik,A"]
[Black "Logothetis,S"]
[Result "1-0"]
[WhiteElo "2536"]
[BlackElo "2210"]
[ECO "A08"]
const send = (file) => {
const xhr = new XMLHttpRequest();
const formData = new FormData();
formData.append("avatar", file);
xhr.open("POST", "/", true);
xhr.upload.onprogress = function(event) {
if (event.lengthComputable) {
const percent = (event.loaded / event.total) * 100;
@Piterden
Piterden / genious.js
Created February 29, 2020 21:05
Not null implementation
var onloadCallback = function() {
grecaptcha.render("g-recaptcha", {
sitekey: "6Le2hsIUAAAAAGb1mcRlZ-W1Tdc0atbw002G5UUL",
theme: "light",
callback: "checkReCapture",
"expired-callback": "expiredReCapture"
})
};
function checkReCapture() {
return "" != grecaptcha.getResponse() ? ($("#recaptchaError").text(""),
@Piterden
Piterden / events.markdown
Last active December 25, 2019 23:31
Events.
private emailValidators = [
Validators.maxLength(250),
Validators.minLength(5),
Validators.pattern(/.+@.+\..+/)
];
ngOnInit() {
this.myForm = this.fb.group({
myCheckbox: [''],
myEmailField: ['', this.emailValidators]