Skip to content

Instantly share code, notes, and snippets.

View fedecarg's full-sized avatar
🥄
There is no spoon

Federico Cargnelutti fedecarg

🥄
There is no spoon
View GitHub Profile
$ sudo npm install pm2 -g
/opt/bitnami/nodejs/bin/pm2 -> /opt/bitnami/nodejs/lib/node_modules/pm2/bin/pm2
/opt/bitnami/nodejs/bin/pm2-dev -> /opt/bitnami/nodejs/lib/node_modules/pm2/bin/pm2-dev
/opt/bitnami/nodejs/bin/pm2-runtime -> /opt/bitnami/nodejs/lib/node_modules/pm2/bin/pm2-runtime
/opt/bitnami/nodejs/bin/pm2-docker -> /opt/bitnami/nodejs/lib/node_modules/pm2/bin/pm2-docker
+ [email protected]
added 242 packages in 15.45s
bitnami@~/www/commerce-api$ pm2

Commerce Prototype - Project Overview

  • The goal of the project is to build an optimised version of the Commerce Journey to improve the user experience and maximise conversion. Why? Because in the last 4 months, less than 6% of all visits to the pass pages resulted in a sale.

  • We will create a fully working interactive prototype of the desired Commerce Journey using mocked data on a production environment with production ready code.

  • We will use extensive usability research, purchase funnel and commercial requirements to build the prototype.

  • The prototype will consist of a single responsive web application alongside multiple variants.

@fedecarg
fedecarg / notifications_rules.md
Last active May 23, 2018 15:31
Notifications

Notifications

Collections

The purpose of the notification-feed-all collection is to allow the client to retrieve a list of manual and automatic collections, including:

  • notification-feed-info (manual)
  • notification-feed-new-shows (automatic)
    • Sort: Shows - has new episodes
  • notification-feed-expiring-shows (automatic)
@fedecarg
fedecarg / object_types.js
Last active June 12, 2018 08:57
Another way to type javascript objects
/**
* Checks the data type of property and throws a TypeError if it's invalid.
*
* Usage:
*
* function test(options = {}) {
* checkObjectTypes(options, {'a':'String', 'b':'Number', 'c':'Array'});
* }
*
* @param {Object} obj
@fedecarg
fedecarg / load_script.js
Last active November 28, 2017 10:01
Load scripts asynchronously
const loadScript = (uri) => {
return new Promise((resolve, reject) => {
const el = document.createElement('script');
el.type = 'text/javascript';
el.src = uri;
if (id) {
const docEl = document.getElementById(id);
if (docEl) {
docEl.parentNode.removeChild(docEl);

Application architecture

To allow digital products to flourish we must provide a strong architectural foundation that supports high product quality, cost effective and time effective delivery and operational simplicity.

Application architecture seeks to build a bridge between business requirements and technical requirements by understanding use cases, and then finding ways to implement those use cases in the software. Good architecture reduces the business risks associated with building a technical solution. A good design is sufficiently flexible to be able to handle the natural drift that will occur over time in hardware and software technology, as well as in user scenarios and requirements.

Architectural styles

Modern tools and platforms help to simplify the task of building applications, but they do not replace the need to design your application carefully, based on your specific scenarios and requirements. The risks exposed by poor architecture include software that is unstable, is unable to sup

@fedecarg
fedecarg / node-mock-es6-import.js
Last active July 13, 2017 22:27
Mocking es6 imports in javascript unit tests
import {assert} from 'chai';
import sinon from 'sinon';
import mockRequire from 'mock-require';
describe('My module', () => {
let module; // module under test
let mocks;
[
{
"media":{
"externalId":"p0475dm9",
"caption":"Rory Cellan-Jones asks if the iPhone 7 will return Apple's handset sales to growth",
"entityType":"Clip",
"id":{
"type":"videos",
"key":"primary",
"numericId":37303875
@fedecarg
fedecarg / vbox-guest-additions.sh
Last active January 27, 2020 11:53
GuestAdditions versions on your host (version) and guest (version) do not match
#
# How to update VirtualBox Guest Additions with vagrant
#
$ vagrant up
# Check the guest additions version:
$ vagrant vbguest --status
# If there's a version mismatch, you should see this message:
# [default] GuestAdditions versions on your host (x.x.x) and guest (x.x.x) do not match.