Skip to content

Instantly share code, notes, and snippets.

View medikoo's full-sized avatar

Mariusz Nowak medikoo

View GitHub Profile
@tracker1
tracker1 / 01-directory-structure.md
Last active April 20, 2025 18:24
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@XOP
XOP / ft2014_review.md
Last active September 5, 2016 09:58
Front-Trends 2014 extended review with links and stuff

DISCLAIMER:
The whole content comes "as is".
All commentaries refer to author's impression.
Some inconsistency possible as well.
The few details (mainly useful links) were added while transcribing notes.


From Imperium by Ryszard Kapuściński, first published in Poland in 1993:

Page 277

It is not surprising that the Ukrainian Language Society was among those groups attacked and oppressed. The revolution in the Ukraine, like everywhere else, was waged at least partly over language. Half of the fifty-two million inhabitants of the Ukraine either do not speak Ukrainian, or they speak it poorly. Three hundred and fifty years of Russification have inevitably produced such a result. The ban against printing book in Ukrainian was in force for decades. As early as 1876, Alexander II ordered that instruction in Ukrainian schools take place only in Russian. Several months ago I visited the third-largest city in the Ukraine — Donetsk. The battle to open at least one elementary school teaching Ukrainian was by then already in its second year. Teachers assembled children in the park and there instructed them in Ukrainian. Teaching Ukrainian? Why, that was counterrevolution, an imperialist conspiracy!

Also in Donets

@medikoo
medikoo / es6-shims.md
Last active March 24, 2021 22:29
List of ECMAScript 6 shims

List of ECMAScript 6 shims

Implemented on top of ECMAScript 5

Provided as distinct CJS modules, installable via npm


ECMAScript 5 Built-in Objects extensions

Individual modules of es5-ext package. See ES6 features for usage information.

Array

Today I had a brief debate on twitter about AMD vs CommonJS, https://twitter.com/TechWraith/status/441387541778808832. It's a debate worth having for sure. But I had to bail out of this one. The thing that annoyed me is that the first argument that people bring up to disquality AMD is "the syntax is too complex". I disagree with this. There are lots of reasons to prefer CommonJS over AMD, but the module authoring syntax is not a very good one. There was also a related statement that AMD authoring introduces more "cognitive overhead". This is absolutely true. But I don't consider this to be synonymous with "complexity" by any means.

So I thought I'd explore some comparable examples. Here's a simple one that was offered up by someone else in the thread. This was on twitter so I can forgive erring on the side of brevity.

AMD

define('myThing', ['some', 'deps'], function (some, deps) {
  //my code
  
 return myThing;
@vcarel
vcarel / .jshintrc
Last active December 5, 2016 15:35
Bootstrap for static websites with Grunt and Webmake (featuring Stylus, cssmin, htmlmin, jshint...)
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
@dherman
dherman / realms-api.md
Last active September 7, 2024 17:42
ES6 Realms API

Notational Conventions

This section describes the conventions used here to describe type signatures.

A [T] is an array-like value (only ever used read-only in this API), i.e., one with an integer length and whose indexed properties from 0 to length - 1 are of type T.

A type T? should be read as T | undefined -- that is, an optional value that may be undefined.

Realms

@dherman
dherman / loader-api.md
Last active January 31, 2019 03:02
Complete ES6 Loader API

Notational Conventions

This section describes the conventions used here to describe type signatures.

A [T] is an array-like value (only ever used read-only in this API), i.e., one with an integer length and whose indexed properties from 0 to length - 1 are of type T.

A type T? should be read as T | undefined -- that is, an optional value that may be undefined.

Loaders

@domenic
domenic / es6-modules.md
Last active December 26, 2015 00:19
Authoritative ES6 Modules Resources

This is an initial attempt at gathering together up to date resources on ES6 modules.

  • The ES6 draft spec has an up-to-date grammar and list of early errors. It's not the easiest thing to read, but is the most authoritative.
  • This informal grammar summary is pretty good, and starts to explain how default exports work.
  • These two comments in sequence give examples of all the import and export forms available.
  • jorendorff/js-loaders is a polyfill for the module loader API and pipeline, and is where current work is taking place.
  • This essay is out of date in many ways, but I believe its explanation of the loader pipeline is still more or less accurate. To be sure you'd have to check it agai
@WebReflection
WebReflection / gist:6225242
Created August 13, 2013 20:16
serializing RegExp
/o/.toJSON || (RegExp.prototype.toJSON = function () {
return [
this.source,
(this.global ? "g" : "") +
(this.ignoreCase ? "i" : "") +
(this.multiline ? "m" : "")
];
});
var re = /test/g;
alert(RegExp.apply(null, JSON.parse(JSON.stringify(re))));