Skip to content

Instantly share code, notes, and snippets.

View ischenkodv's full-sized avatar

Dmitri Ischenko ischenkodv

  • Ukraine, Kryvyi Rih
View GitHub Profile
import {ReadableStream} from 'node:stream/web';
/**
* @param iterable an iterable (asynchronous or synchronous)
*
* @see https://streams.spec.whatwg.org/#example-rs-pull
*/
function iterableToReadableStream(iterable) {
return new ReadableStream({
async start() {
@jakebrinkmann
jakebrinkmann / .flake8
Last active April 22, 2024 13:42
Using the Python poetry tool to manage dependencies of an AWS Serverless (AWS-SAM-CLI) project.
##### https://flake8.pycqa.org/en/latest/user/configuration.html
[flake8]
ignore =
# D100: Missing docstring at top of file
D100,
# D104: Missing docstring in __init__.py
D104,
# D401: Docstring first line should be imperative
D401,
# D101 Missing docstring in public class
@btroncone
btroncone / rxjs_operators_by_example.md
Last active June 15, 2024 07:17
RxJS 5 Operators By Example
@paulirish
paulirish / what-forces-layout.md
Last active July 3, 2024 16:54
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@remy
remy / _README.md
Last active January 12, 2024 11:57
requestAnimationFrame helper

raf.js

A simple script with a few niceties that allows for multiple requestAnimationFrame calls, and FPS pinning.

How it works

The script polyfills rAF if required, then overloads requestAnimationFrame and cancelAnimationFrame with a process that allows multiple frames to be queued up for rAF to run.

This is useful if there are multiple animations running on the page, you want all the callbacks to happen at once, and not on multiple rAF calls. This script is meant as a drop-in solution to that problem.

@tedmiston
tedmiston / nodejs-tcp-example.js
Last active May 20, 2024 11:27
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@isaacs
isaacs / .vimrc
Created November 10, 2012 04:08
set list listchars=tab:\ \ ,trail:·
@ralphschindler
ralphschindler / example.php
Created October 24, 2012 23:18
Zend\Db\Sql\Select example usage
<?php
use Zend\Db\Sql\Select;
// basic table
$select0 = new Select;
$select0->from('foo');
// 'SELECT "foo".* FROM "foo"';