Skip to content

Instantly share code, notes, and snippets.

View ibqn's full-sized avatar

Evgeny Bobkin ibqn

  • Europace AG
  • Berlin - Deutschland
View GitHub Profile
@ibqn
ibqn / browser-ndjson-stream-reader.js
Created January 28, 2022 22:12 — forked from ornicar/browser-ndjson-stream-reader.js
Read a ND-JSON stream from the browser or from nodejs
/* FOR THE BROWSER
Utility function to read a ND-JSON HTTP stream.
`processLine` is a function taking a JSON object. It will be called with each element of the stream.
`response` is the result of a `fetch` request.
See usage example in the next file.
*/
const readStream = processLine => response => {
const stream = response.body.getReader();
const matcher = /\r?\n/;

How to optimize SVG

Editors like Illustrator can save out some really dumb SVG code sometimes. Properly optimized SVG files can be as much as 80% smaller. Bunches of empty groups, pointless attributes and many other inefficiencies decrease readability and reliability.

Every SVG file should be manually optimized in 3 passes using:

  1. Your vector graphic editor.
  2. The SVGO command-line optimization tool.
  3. Your text editor.
@ibqn
ibqn / index.html
Created November 26, 2022 22:28 — forked from diegoquintanav/index.html
How to pass variables from html script tags to the react.js DOM
<div id="container" data-stuff="my variable">
<!-- This element's contents will be replaced with your component. -->
</div>
<script>
window.test = "my react test";
window.dumbname = "martin"
// notice that `stuff` is not passed directly, it is passed using `data-stuff="my variable"` through `container.dataset`
</script>
@ibqn
ibqn / PlayStationBIOSFilesNAEUJP.md
Created March 18, 2024 20:53 — forked from juanbrujo/PlayStationBIOSFilesNAEUJP.md
Files for PlayStation BIOS Files NA-EU-JP