Skip to content

Instantly share code, notes, and snippets.

View gustavoalbuquerquebr's full-sized avatar

Gustavo Albuquerque gustavoalbuquerquebr

View GitHub Profile
@gustavoalbuquerquebr
gustavoalbuquerquebr / fizzbuzz.js
Last active November 30, 2020 16:13
#fizzbuzz
// "Write a program that prints the numbers from 1 to 100.
// But for multiples of three print “Fizz” instead of the number
// and for the multiples of five print “Buzz”.
// For numbers which are multiples of both three and five print “FizzBuzz”."
// 1 - simplest
function one() {
for (let i = 1; i <= 100; i++) {
if (i % 3 === 0 && i % 5 === 0) { // this is the same as 'i % 15 === 0'
console.log("FizzBuzz");
@gustavoalbuquerquebr
gustavoalbuquerquebr / yarn.md
Last active January 15, 2021 10:53
#yarn #cheatsheet

npm vs yarn

  • upon release, yarn had many advantages compared to npm
  • however, the rise of yarn pushed npm to make improvements and the competion has became increasingly tighten
  • though, yarn is still (even after npm 6.0) somewhat faster
  • the popularity gap is slowly closing but npm still is the most popular

Install

EditorConfig

What is

  • helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs

How

  • consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles

Install

cli

  • run from the cli:
    • npm i -D postcss-cli autoprefixer = autoprefixer is a PostCSS plugin and to be run from the cli requires 'postcss-cli'

webpack

  • to include in a webpack bundle:

Install NodeJS in Ubuntu

1 - apt install nodejs

  • Usually is outdated.

2 - NodeSource

Source

  • curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -