Skip to content

Instantly share code, notes, and snippets.

View hendrikniemann's full-sized avatar
🐯
Rawwwr

Hendrik Niemann hendrikniemann

🐯
Rawwwr
View GitHub Profile
@RAMPKORV
RAMPKORV / getRequestedFields.js
Created September 9, 2020 19:47
Parse ASTInfo to determine which of a set of GraphQL fields that have been requested
/* Given a list of fields, such as [ 'a', 'b', 'c' ] and ASTInfo, return an object
on the form {a: true, b: false, c: true } where a property is true if the field is requested through the ASTInfo */
const getRequestedFields = (fieldNames, info) => {
let { fieldNodes, fragments } = info;
let result = {};
for (let i = 0; i < fieldNodes.length; i++) {
if (!fieldNodes[i].selectionSet) {
continue;
}
for (let j = 0; j < fieldNodes[i].selectionSet.selections.length; j++) {
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active December 3, 2025 19:19
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages

Pattern Matching

This is a strawman proposal for adding pattern matching to ECMAScript. Pattern matching is useful for matching a value to some structure in a similar way to destructuring. The primary difference between destructuring and pattern matching are the use cases involved - destructuring is useful for binding pieces out of larger structures whereas pattern matching is useful for mapping a value's structure to data or a set of behaviors. In practice this means that destructuring tends to allow many shapes of data and will do its best to bind something out of it, whereas pattern matching will tend to be more conservative.

Additionally, the power of pattern matching is increased substantially when values are allowed to participate in the pattern matching semantics as a matcher as well as a matchee. This proposal includes the notion of a pattern matching protocol - a symbol method that can be implemented by objects that enables developers to use those values in pattern matching. A common scenario w

@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real