Skip to content

Instantly share code, notes, and snippets.

View Elergy's full-sized avatar

Evgenii Ponomarev Elergy

View GitHub Profile
addBook (author, title) {
const book = this._findExisting(author, title);
if (book) {
book.total += 1;
book.available += 1;
} else {
this._books.push({
info: {
author: author,
title: title,
const state = {
navigationPanel: {
projects: [
{ id: 1, title: 'Work' },
{ id: 2, title: 'Personal' }
]
},
mainContent: {
todos: [
{ id: 1, title: 'First task', project: 'Work' },
const state = {
projects: [
{ id: 1, title: 'Work' },
{ id: 2, title: 'Personal' },
],
todos: [
{ id: 1, title: 'First task', projectId: 1 },
{ id: 2, title: 'Second task', projectId: 2 },
]
};

Process

  1. Step 1: ask people a question without explanation
  2. Step 2: give them documentation covering this piece and ask again
  3. Step 3: ask them whether it generally makes sense for them. Why not?

Example of the process

What this code would log?

web-ext sign --api-key=user:14760837:724 --api-secret=967445ccc5c6127bd423dcb6b2d2fe00e23471ec60d22d52fa6aec0857c0ad5e
function getInformationAboutPets() {
const cats = CAT_SERVICE.getAllCats();
const dogs = DOG_SERVICE.getAllDogs();
const dragons = DRAGON_SERVICE.getAllDragons();
return [cats, dogs, dragons];
}
function getAllDragons() {
try {
const infoAboutDragons = DATABASE.getAll({type: 'dragons'});
return infoAboutDragons;
} catch (ex) {
throw new DatabaseError();
}
}
{
"name": "my-first-extension",
"version": "1.0.0",
"manifest_version": 2,
"application": {
"id": "myfirstextension@evgenii.info"
}
}
{
"name": "my-first-extension",
"version": "1.0",
"manifest_version": 2
}
{
"name": "Getting Started Example",
"version": "1.0",
"description": "Build an Extension!",
"manifest_version": 2
}