Skip to content

Instantly share code, notes, and snippets.

View asvetly's full-sized avatar

Aleksandr Svetly asvetly

View GitHub Profile
@lananovikova10
lananovikova10 / teamleadconf.md
Last active June 5, 2024 11:38
additional materials from teamlead conf

Тут живут драконы. Матрица навыков как инструмент тимлида

Другие варианты матриц для команд разработки

@davidgilbertson
davidgilbertson / http2.js
Last active October 9, 2023 06:09
HTTP2 server with compression and caching
const http2 = require('http2');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const brotli = require('brotli'); // npm package
const PORT = 3032;
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/');
const cache = {};
@heygrady
heygrady / mapDispatchToProps.md
Last active September 16, 2023 19:19
Redux containers: mapDispatchToProps

Redux containers: mapDispatchToProps

This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps argument of the connect function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps can take.

@codediodeio
codediodeio / database.rules.json
Last active June 1, 2024 14:26
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@OmarShehata
OmarShehata / Pixi.js Smoke Shader
Created May 16, 2016 14:45
Example of smoke shader in Pixi.js
<!DOCTYPE html>
<html>
<head>
<title>PixiJS Shaders</title>
<style type="text/css">
body {
margin: 0;
overflow: hidden;
}
</style>
@paulirish
paulirish / what-forces-layout.md
Last active June 15, 2024 19:14
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
@kareman
kareman / Queue.swift
Last active July 31, 2020 19:16
A standard queue (FIFO - First In First Out) implemented in Swift. Supports simultaneous adding and removing, but only one item can be added at a time, and only one item can be removed at a time. Using the "Two-Lock Concurrent Queue Algorithm" from http://www.cs.rochester.edu/research/synchronization/pseudocode/queues.html#tlq, without the locks.
//
// Queue.swift
// NTBSwift
//
// Created by Kåre Morstøl on 11/07/14.
//
// Using the "Two-Lock Concurrent Queue Algorithm" from http://www.cs.rochester.edu/research/synchronization/pseudocode/queues.html#tlq, without the locks.
// should be an inner class of Queue, but inner classes and generics crash the compiler, SourceKit (repeatedly) and occasionally XCode.
@staltz
staltz / introrx.md
Last active June 15, 2024 12:24
The introduction to Reactive Programming you've been missing
@darbicus
darbicus / icosahedron.js
Last active September 26, 2022 08:28
3d icosahedron on a 2d canvas
function Point3d(a, c, b) {
this.x = (a === undefined) ? 0 : a;
this.y = (c === undefined) ? 0 : c;
this.z = (b === undefined) ? 0 : b;
this.fl = 400;
this.vpX = 0;
this.vpY = 0;
this.cX = 0;
this.cY = 0;
this.cZ = 0
@robschmuecker
robschmuecker / README.md
Last active May 13, 2024 20:57
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

Dragging can be performed on any node other than root (flare). Dropping can be done on any node.

Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.