Skip to content

Instantly share code, notes, and snippets.

View image72's full-sized avatar

image72 image72

View GitHub Profile
@image72
image72 / mocker.js
Created July 28, 2023 17:40
auto mock response via request points.
#!/usr/bin/env node
// websocketd --port 8058 ./mocker.js
const querystring = require('querystring');
const qs = process.env?.QUERY_STRING.replace('QUERY_STRING=', '');
const qsObj = querystring.parse(qs);
process.stdin.resume();
process.stdin.setEncoding('utf8');
@image72
image72 / readLineAssync.js
Created July 28, 2023 16:09 — forked from mauroao/readLineAssync.js
Node.js - Read line from stdin asynchronously (async / await)
const readline = require('readline');
const readLineAsync = () => {
const rl = readline.createInterface({
input: process.stdin
});
return new Promise((resolve) => {
rl.prompt();
rl.on('line', (line) => {
@image72
image72 / mxshape-yf.js
Last active July 25, 2023 06:23
drawio custom shape with properties. all in one.
Draw.loadPlugin(function (ui) {
const graph = ui.editor.graph;
function mxShapeYFLamp(bounds, fill, stroke, strokewidth) {
mxShape.call(this);
this.bounds = bounds;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
this.shadow = false;
};
@image72
image72 / a-responsive-handmade-svg-form.markdown
Created July 21, 2023 08:00
A Responsive Handmade SVG Form

A Responsive Handmade SVG Form

“In previous tutorials, I’ve shown you how to build a responsive form with flexbox as well as how to style form elements. Today, we’ll continue the journey into the “forms” world and learn to create a responsive handmade SVG form from scratch.”

Read full tutorial

A Pen by Envato Tuts+ on CodePen.

License.

@image72
image72 / convert-svg-path-to-all-relative-or-all-absolute.markdown
Created July 20, 2023 13:02
Convert SVG path to all-relative or all-absolute
@image72
image72 / chrome-svg-foreignobject-scroll-defect.markdown
Created July 17, 2023 10:01
Chrome SVG foreignobject scroll defect
function createStore(reducer, enhancer) {
if (enhancer) {
return enhancer(createStore)(reducer);
}
let state = reducer(undefined, { type: "@@INIT" });
const listeners = [];
return {
dispatch: (action) => {
state = reducer(state, action);
listeners.forEach((listener) => {
@image72
image72 / index.html
Created June 28, 2023 09:34
Radial Menu Popover
<div class="menu">
<button class="menu-toggle" id="menu-toggle" popovertarget="menu-items">
<div aria-hidden="true">➕</div>
<div class="sr-only">open menu</div>
</button>
<menu class="menu-items" id="menu-items" popover anchor="menu-toggle">
<li class="item">
<button>
<div aria-hidden="true">♥️</div>
<div class="sr-only">add to favorites</div>