Skip to content

Instantly share code, notes, and snippets.

@Minobi
Minobi / .babelrc
Last active February 3, 2020 08:31
Babel config file for Preact
{
"presets": [
"@babel/preset-env"
],
"plugins": [
[
"@babel/plugin-transform-react-jsx",
{
"pragma": "h",
"pragmaFrag": "Fragment",
@Minobi
Minobi / smooth.js
Last active September 3, 2020 08:13
Smooth scroll to anchors on click with jQuery animate
$('a.page-scroll').on('click', event => {
event.preventDefault();
$('html, body').stop().animate({
scrollTop: $($(event.target).attr('href')).offset().top - 100
}, 1000, 'easeInOutExpo');
});
@Minobi
Minobi / index.py
Created May 14, 2021 08:07
Template file for running Flask in production on Repl.it with Gevent and Flask-Compress
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
from gevent.pywsgi import WSGIServer
from flask_compress import Compress
from flask import Flask, render_template
app = Flask(__name__)
@Minobi
Minobi / fileListModify.js
Last active October 7, 2021 12:15
Add and remove file from non-modifying FileList in input type "file"
function addFile(fileInput, event) {
const dt = new DataTransfer();
Array.from(fileInput.files).forEach(file => {
dt.items.add(file);
});
Array.from(event.dataTransfer.files).forEach(file => {
dt.items.add(file);
});
@Minobi
Minobi / index.html
Created October 7, 2021 13:19
Textarea autoresize
<!DOCTYPE html>
<html lang="en">
<head>
<title>Textarea autoresize</title>
<style>
textarea {
resize: none;
width: 15rem;
height: 3rem;
margin: 10% 45%;
@Minobi
Minobi / square.css
Last active December 22, 2022 13:07
Square div block with height equal to width
.outer {
position: relative;
}
.outer:before {
content: "";
display: block;
padding-top: 100%;
}
@Minobi
Minobi / ZGuard.txt
Created April 10, 2023 11:37
ZGuard.dll methods list
ZG_Ctr_AssignAddr
ZG_Ctr_ClearKeys
ZG_Ctr_ControlDevices
ZG_Ctr_DecodeEcEvent
ZG_Ctr_DecodeFireEvent
ZG_Ctr_DecodeModeEvent
ZG_Ctr_DecodePassEvent
ZG_Ctr_DecodeSecurEvent
ZG_Ctr_DecodeUnkKeyEvent
ZG_Ctr_EnableEmergencyUnlocking
@Minobi
Minobi / leaflet.init.js
Last active January 3, 2024 07:38
Leaflet.js initialization script with OpenStreetMap, Google, Yandex and 2GIS tile servers without using API, see in action on https://codepen.io/Minobi/pen/GRQrOQP
import L from 'leaflet';
const leafletMap = (mapContainer, center) => {
const osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors'
});
const googleSatellite = L.tileLayer('https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
attribution: '<a http="https://google.com" target="_blank">Google</a>'