Skip to content

Instantly share code, notes, and snippets.

View leo-bianchi's full-sized avatar

Leo Bianchi leo-bianchi

  • Alpar Service
  • São Paulo, SP
View GitHub Profile
function stockAndCount(n, arr) {
let pairs = 0; // pairs number
const colors = arr.reduce((acc, val) => {
acc[val] ? (acc[val] += 1) : (acc[val] = 1);
return acc;
}, {}); // return an object with colors (numbers) as keys and quantity as value
Object.keys(colors).forEach((n) => { // for each key in colors
let _pair = parseInt(colors[n] / 2); // looks for even numbers
if (_pair >= 1) pairs += _pair; // total
@leo-bianchi
leo-bianchi / README-Template.md
Created June 6, 2019 19:07 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@leo-bianchi
leo-bianchi / gogs
Created December 12, 2018 14:28 — forked from erlhermit/gogs
#! /bin/sh
### BEGIN INIT INFO
# Provides: gogs
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Git repository manager Gogs
# Description: Starts and stops the self-hosted git repository manager Gogs
### END INIT INFO