Skip to content

Instantly share code, notes, and snippets.

Hello from Italy!

Francesco Napoletano napolux

Hello from Italy!
Block or report user

Report or block napolux

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
View transport.go
package napodate
import (
// In the first part of the file we are mapping requests and responses to their JSON payload.
type getRequest struct{}
View service_test.go
package napodate
import (
func TestStatus(t *testing.T) {
srv, ctx := setup()
View service.go
type dateService struct{}
// NewService makes a new Service.
func NewService() Service {
return dateService{}
// Status only tell us that our service is ok!
func (dateService) Status(ctx context.Context) (string, error) {
return "ok", nil
View service.go
package napodate
import "context"
// Service provides some "date capabilities" to your application
type Service interface {
Status(ctx context.Context) (string, error)
Get(ctx context.Context) (string, error)
Validate(ctx context.Context, date string) (bool, error)
napolux / package.json
Created Feb 15, 2019
How to add comments to your package.json (see at the end of the file)
View package.json
"name": "napolux-frontend",
"version": "1.0.0",
"description": "it's a test",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"author": "",
"license": "MIT",
napolux /
Last active Aug 30, 2018
Print the size of redis keys in a readable way (I use it for sets)
for SET in `redis-cli --scan --pattern 'set:*'`
printf "%s\t%s\n" $SET `redis-cli SCARD $SET`
# example output
# set:2454148031 33
# set:1497228031 1932
# set:524015031 418
View AmazonMiddleware.php
namespace API\Middleware;
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
* Class AmazonMiddleware
* @package API\Middleware
class AmazonMiddleware
napolux / index.js
Created Aug 17, 2018
Scrap a webpage with node.js
View index.js
const puppeteer = require('puppeteer');
const URL = '';
puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] }).then(async browser => {
const page = await browser.newPage();
await page.setViewport({width: 320, height: 600})
await page.setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 9_0_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13A404 Safari/601.1')
await page.goto(URL, {waitUntil: 'networkidle0'});
await page.waitForSelector('');
napolux / docker-compose.yml
Created Jun 4, 2018
My WordPress docker-compose.yml configuration
View docker-compose.yml
version: '3'
image: mysql:5.7
- db_data:/var/lib/mysql
restart: always
napolux / napolux.xml
Created Jan 31, 2017
Napolux OPML file
View napolux.xml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<title>Francesco subscriptions in feedly Cloud</title>
<outline text="Apple" title="Apple">
<outline type="rss" text="MacRumors : Mac News and Rumors" title="MacRumors : Mac News and Rumors" xmlUrl="" htmlUrl=""/>
<outline type="rss" text="Gioxx's Wall" title="Gioxx's Wall" xmlUrl="" htmlUrl=""/>
You can’t perform that action at this time.