Skip to content

Instantly share code, notes, and snippets.

View VivaRado's full-sized avatar
🌵
https://twitter.com/vivarado/status/1667845032655704064

VRD VivaRado

🌵
https://twitter.com/vivarado/status/1667845032655704064
View GitHub Profile
@VivaRado
VivaRado / dialogue.css
Last active February 5, 2024 13:42
Dialogue Class
dialog>* {
padding: 1em;
z-index: 50;
position: relative;
display: table;
}
/*dialog*/
dialog {
width: 60%;
@VivaRado
VivaRado / _on.js
Last active February 1, 2024 16:01
_on (chaining, data-*event, function coupling)
EventTarget.prototype._on = (function(){
const _on = EventTarget.prototype.addEventListener;
return function(events, listener, capture, control) {
var _this = this;
var assign_data_event = function(dv){
for (var x = 0; x < dv.length; x++) {
var fname = dv[x];
var itms = document.querySelectorAll(`[${k}=${fname}]`);
var evt = k.split('-')[1];
for (var y = 0; y < itms.length; y++) {
@VivaRado
VivaRado / file_a.js
Last active April 30, 2023 07:50
Browserify CMD vs GULP
module.exports = req_a;
function req_a() {
}
@VivaRado
VivaRado / svg_pd_compress_chi.py
Last active April 26, 2023 14:00
Round to Closest Half Integer and Remove Trailing .0
import re
def close_half_int(number):
"""Round a number to the closest half integer.
>>> close_half_int(1.3)
1.5
>>> close_half_int(2.6)
2.5
>>> close_half_int(3.0)
3.0
@VivaRado
VivaRado / d-opentype.js
Last active November 26, 2022 10:01
To get d path to commands (d-path-parser, opentype.js)
//**Trash code included.**
//Include: [d-path-parser](https://github.com/MaxArt2501/d-path-parser)
//Include: [opentype.js](https://github.com/opentypejs/opentype.js)
// path S from AEOLUM
path_d = "M298.0 -352.0L161.0 -352.0C84.0 -352.0 24.0 -414.0 24.0 -491.0C24.0 -564.0 84.0 -625.0 161.0 -625.0L355.0 -625.0L390.0 -589.0L395.0 -589.0L410.0 -601.0L364.0 -650.0L161.0 -650.0C70.0 -650.0 0.0 -578.0 0.0 -491.0C0.0 -397.0 71.0 -327.0 162.0 -327.0L298.0 -327.0C382.0 -327.0 452.0 -262.0 452.0 -178.0C452.0 -94.0 382.0 -25.0 298.0 -25.0L52.0 -25.0L21.0 -62.0L16.0 -62.0L0.0 -49.0L42.0 0.0L298.0 0.0C396.0 0.0 476.0 -80.0 476.0 -178.0C476.0 -276.0 396.0 -352.0 298.0 -352.0";
var commands = parse(path_d);
const aPath = new opentype.Path();