Skip to content

Instantly share code, notes, and snippets.

View iddan's full-sized avatar

Iddan Aaronsohn iddan

View GitHub Profile
@Rich-Harris
Rich-Harris / footgun.md
Last active June 1, 2024 17:52
Top-level `await` is a footgun

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@jfmengels
jfmengels / lodash-fp-documentation.md
Last active February 6, 2024 20:57
Generated docs for Lodash/fp. Help make them better at https://github.com/jfmengels/lodash-fp-docs
@mweststrate
mweststrate / profile.jsx
Last active September 13, 2020 08:08
mobx-example
class Person {
@observable firstName = "Michel";
@observable lastName = "Weststrate";
@observable nickName;
@computed get fullName() {
return this.firstName + " " + this.lastName;
}
}
@evenicoulddoit
evenicoulddoit / _bem.scss
Created November 26, 2015 13:50
BEM and Sass
/**
* BEM Helper methods. Inspired by http://bit.ly/1QqAOhR.
* Provides mixins @block, @element and @modifier.
* Requires SassyLists and SassyStrings.
*/
$bem-element-separator: '__';
$bem-modifier-separator: '--';
/**
* Return a list of all of the rules within the selector
@lambdahands
lambdahands / _readme.md
Created September 28, 2015 17:09
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";
@vvgomes
vvgomes / foo.js
Last active August 10, 2021 18:10
Ramda vs Lodash
var _ = require("lodash");
var R = require("ramda");
var companies = [
{ name: "tw", since: 1993 },
{ name: "pucrs", since: 1930 },
{ name: "tw br", since: 2009 }
];
var r1 = _(companies).chain()
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active May 27, 2024 22:57
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@DmitrySoshnikov
DmitrySoshnikov / Map.prototype.map.md
Last active January 3, 2022 15:41
Map.prototype.map

Map.prototype.map ( callbackfn [ , thisArg ] )

The map method calls MapTransform abstract operation passing this value as M, callbackfn, thisArg as is, and false as updateKey.

The length property of the map method is 1.

Map.prototype.mapEntries ( callbackfn [ , thisArg ] )

The mapEntries method calls MapTransform abstract operation passing this value as M, callbackfn, thisArg as is, and true as updateKey.

@DmitrySoshnikov
DmitrySoshnikov / Map.prototype.filter.md
Created October 1, 2014 22:24
Map.prototype.filter

Map.prototype.filter ( callbackfn [ , thisArg ] )

NOTE callbackfn should be a function that accepts three arguments. filter calls callbackfn once for each key/value pair present in the map object, in key insertion order, and returns a new filtered map. callbackfn is called only for keys of the map which actually exist; it is not called for keys that have been deleted from the map.

If a thisArg parameter is provided, it will be used as the this value for each invocation of callbackfn. If it is not provided, undefined is used instead.

callbackfn is called with three arguments: the value of the item, the key of the item, and the Map object being traversed.

filter does not directly mutate the object on which it is called but the object may be mutated by the calls to callbackfn.

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: