Skip to content

Instantly share code, notes, and snippets.

View MayaLekova's full-sized avatar

Maya Lekova MayaLekova

View GitHub Profile
@MayaLekova
MayaLekova / test.js
Created March 6, 2019 13:14
Microticks-independent `chain`
async function chain(iterator, cancelAccessorF) {
if (cancelAccessorF) {
cancelAccessorF(e => {
return Promise.reject(e);
});
}
for (const p of iterator) {
await p;
}
@MayaLekova
MayaLekova / status.md
Last active July 12, 2018 15:44
Promise use cases follow up
  • async_hooks status update
    • Ongoing work to support promise hooks to run entirely in JS (will allow for performance optimizations)
  • async stack traces status update
  • exit on unhandled rejections update + proposal
    • Implemented Swallowed Rejection Hook in V8
    • Benedikt can give more info
    • TODO: Is it possible to port to V8 6.7?
  • update on the postmortem work
  • status of the proposal to go from 3 ticks to 1 tick per await?
    • preparatory Editorial change merged; need to address comment
@MayaLekova
MayaLekova / interleave.js
Created June 13, 2018 22:42
Interleaving of await and promises
async function pr(v) { console.log("pr(" + v + ")"); }
async function f() { for (var i = 0; i < 10; i++) { await pr(i); } return 0; }
function ct(v) { console.log("counter" + v); if (v > 0) Promise.resolve(v - 1).then(ct); }
ct(10); f();
@MayaLekova
MayaLekova / draw-async-tree.js
Last active June 4, 2018 11:13
Tool to draw trees out of async resource ids
const fs = require('fs');
const D3Node = require('d3-node')
const d3n = new D3Node();
const d3 = d3n.d3;
const w = 400, h = 300;
// Draw the contents of the 'root' hierarchy in the 'svg' element
function draw(root, svg) {
// Nodes
@MayaLekova
MayaLekova / Patches Win instructions.md
Created February 6, 2018 13:00
Instructions for setting up Patches on Windows
  1. MongoDB
    1. Installation instructions can be found here.
  2. Redis
    1. Download an installer for the Windows version by Microsoft Open Tech group and follow the steps
    2. Check in "Services" that "Redis" is running. By default it runs on port 6379
  3. Node.js
    1. Install nvm-windows: instructions
    2. nvm install 6.11
    3. nvm use 6.11
    4. Running node -v should give you "v6.11.x"
@MayaLekova
MayaLekova / array_vs_set.swift
Created April 11, 2017 10:10
Swift data structures time measurement
import Foundation
let collectionSize = 1000
var arr = Array<UInt32>()
var arrInPlace = Array<UInt32>(repeating: 0, count: collectionSize)
var set = Set<UInt32>()
var dict = ["foo": 1, "bar": 2, "baz": 3]
@MayaLekova
MayaLekova / annotation.md
Last active October 5, 2015 15:55
Advanced JS Course Annotation

The target of the Advanced JavaScript course is to introduce students to JavaScript concepts beyond writing simple browser scripts. What's more - the course focuses on typical JS approaches independent of the environment. The topics included in the course concern different aspects of JS development like: event programming, concurrent programming, reactive programming, functional programming applications and lambda calculus, multi-process applications, hyperoperators and set operations. We cover modern topics in the field in the field including:

  • server programming with Node.js;
  • ES2015 and Babel
  • JS in the browser with jQuery and websockets;
  • improtant tools - environments for app development
  • general introduction to Angular, ThreeJS, D3, etc.
I am the Miaou user with id 2028 and name "Maya_Lekova" on https://dystroy.org/miaou
@MayaLekova
MayaLekova / JPGtoLinkAdder
Created May 8, 2015 15:12
JPGtoLinkAdder
// ==UserScript==
// @name JPGtoLinkAdder
// @namespace mayalekova
// @description Adds "?.jpg" to all links on the page (as described in http://debuggable.com/posts/hacking-a-commercial-airport-wlan:480f4dd5-50a0-40c6-aa60-4afccbdd56cb)
// @version 1
// @grant none
var anchors = document.getElementsByTagName("a");
for(var idx = 0; idx < anchors.length; idx++) {
if(anchors[idx].href.indexOf('?') >= 0){
anchors[idx].href += '&.jpg';