Skip to content

Instantly share code, notes, and snippets.

View tonycaputome's full-sized avatar
🏠
Working from home

Antonio Caputo tonycaputome

🏠
Working from home
  • Frontend Engineer
  • Milan, Italy
View GitHub Profile
/*
* Your program must print string with the number of years and months and the total number of days between the dates.
* Dates are provided in dd.mm.yyyy format.
* You are not allowed to plug in JS libraries such as moment.js or date-fns directly into the code. All code need to be written in this file.
*
* Result must be shown as a string in years, months and total days. If years or months are 0, then it should not be displayed in the output.
*
* Example:
* Input: ['01.01.2000', '01.01.2016']
* Output:
@tonycaputome
tonycaputome / Base.js
Created January 16, 2023 20:04 — forked from kjbrum/Base.js
React primitive components using styled-system (with styled-components).
import React, { forwardRef } from 'react'
import styled from 'styled-components'
import css, { get } from '@styled-system/css'
import {
system,
compose,
space,
color,
typography,
layout,
@tonycaputome
tonycaputome / service.js
Created June 13, 2020 05:09 — forked from paulsturgess/service.js
An example Service class wrapper for Axios
import axios from 'axios';
class Service {
constructor() {
let service = axios.create({
headers: {csrf: 'token'}
});
service.interceptors.response.use(this.handleSuccess, this.handleError);
this.service = service;
}
@tonycaputome
tonycaputome / eslint_prettier_airbnb.md
Created May 30, 2020 09:42 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
@tonycaputome
tonycaputome / multiplegit.txt
Created May 28, 2020 09:47 — forked from k4zek4ge/multiplegit.sh
[multiple git accounts] #git
ls -al ~/.ssh
#
# generate ssh key
#
ssh-keygen -t rsa -C "email@work_mail.com" -f "id_rsa_work_user1"
#
#Adding the new SSH key to the corresponding GitHub account
#

Setup an enviroment to allow multiple ssh keys

Create a SSH key

Create a new SSH key

Add the new key to your GitHub/BitBucket account

Change your git project configuration

@tonycaputome
tonycaputome / vscode_shortcuts.md
Created May 28, 2020 09:02 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@tonycaputome
tonycaputome / gist:abe8e0dcf1df27c61b6d89ae5c2c410c
Created May 18, 2020 06:48 — forked from whisher/gist:c8e0453a5fa76b5d6d952919c77ef0c4
reactjs typescript useForm - a simple custom hook to manage form in react
Credit to
https://medium.com/javascript-in-plain-english/react-controlled-forms-with-hooks-538762aab935
import React, { ChangeEvent, FormEvent, useReducer } from "react";
const useForm = (initialState: any) => {
const reducer = (
state: typeof initialState,
payload: { field: string; value: string }
) => {
@tonycaputome
tonycaputome / README.md
Created April 16, 2018 06:38 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version