Skip to content

Instantly share code, notes, and snippets.

🎸
Working from everywhere

Gianluca Casati fibo

🎸
Working from everywhere
Block or report user

Report or block fibo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fibo
fibo / browser-language-codes.js
Created Jul 21, 2019 — forked from wpsmith/browser-language-codes.js
JS: Object of Browser Language Codes
View browser-language-codes.js
// <![CDATA[
var langCodes = {
"af": "Afrikaans",
"sq": "Albanian",
"ar": "Arabic (Standard)",
"ar-dz": "Arabic (Algeria)",
"ar-bh": "Arabic (Bahrain)",
"ar-eg": "Arabic (Egypt)",
"ar-iq": "Arabic (Iraq)",
"ar-jo": "Arabic (Jordan)",
@fibo
fibo / cache.js
Last active Jun 9, 2019
Service Worker implementing stale-while-revalidate caching strategy.
View cache.js
/* global caches, fetch, self */
// Fill here with your cache name-version.
const CACHE_NAME = 'my-cache-v1'
// This is the list of URLs to be cached by your Progressive Web App.
const CACHED_URLS = [
'/',
'/bundle.js',
'/manifest.json',
'/register.js',
@fibo
fibo / README.md
Last active May 16, 2019
Flatten an array of arbitrarily nested arrays of values into a flat array of values. e.g. [[1,2,[3]],4] -> [1,2,3,4].
View README.md

flattenArray

Flatten an array of arbitrarily nested arrays of values into a flat array of values

Usage

// Both CommonJS and ES6 import syntaxes are supported
// import flattenArray from './flattenArray'
const flattenArray = require('./flattenArray')
@fibo
fibo / server.js
Created Jun 28, 2017
meteo server yahoo weather
View server.js
var express = require('express')
var weather = require('yahoo-weather')
var app = express()
app.get('/', (req, res) => {
res.send('hello')
})
app.get('/:city', (req, res) => {
@fibo
fibo / generate_taxonomy.js
Last active Mar 2, 2017
Problem: array of streams. There are two input CSV files streamed to one output JSON file stream. THe code works, but what about scaling the number of inputs? Solution: reduce an array of streams.
View generate_taxonomy.js
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
/**
* Converts a tree path to number
*
* BE.2.8 -> 2 + 100 * 8 + 100^2 * 0 + 100^3 * 0
*
@fibo
fibo / Microservice-component-definition.md
Last active Apr 28, 2016
is a set of requirements that define a microservice component pluggable in an API gateway
View Microservice-component-definition.md

Microservice component

is a set of requirements that define a microservice component pluggable in an API gateway

Definition

A Microservice component is a [microservice][microservices] that serves a [REST API][REST] behind an API Gateway. The API Gateway is, for instance, binded to domain api.example.org and it must serve resources over https. The chosen technology is [nginx][nginx] but can be any reverse proxy.

View CodingGuidelines.md

Coding Guidelines

README Driven Development

From Tom Preston-Werner's article,

Write your Readme first.

Create a README.md in your repository root folder and write there all information

View JavaScriptCodingGuidelines.md
@fibo
fibo / Website-component-definition.md
Last active Jun 30, 2016
is a set of requirements that define a webapp pluggable in a website
View Website-component-definition.md

Website component

is a set of requirements that define a report component pluggable in a console site

Definition

A Website component is a Single-page application embedded in a web site, for instance console.example.org.

The main web site is a container: it provides an authentication layer for users, and an access token to fetch

You can’t perform that action at this time.