Skip to content

Instantly share code, notes, and snippets.

View pedrobritto's full-sized avatar

Pedro Britto pedrobritto

View GitHub Profile

Novas instalações Ubuntu

Versões 16.04+ com Desktop Gnome.

Antes de tudo

# Atualização geral do sistema
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
@pedrobritto
pedrobritto / .zshrc
Last active November 11, 2019 14:58
######################
## Antigen Settings ##
######################
# Source Antigen
source $HOME/antigen.zsh
antigen use oh-my-zsh
antigen bundle git
@pedrobritto
pedrobritto / sample-jest-starter.json
Created April 8, 2019 10:02
Sample package.json from Exercism's test suite.
{
"name": "exercism-javascript",
"version": "0.0.0",
"description": "Exercism exercises in Javascript.",
"author": "Katrina Owen",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/exercism/javascript"
},
// Closure 1
function sum( a ) {
function inner( b ) {
return a + b;
}
// Função inner é retornada e poderá
// ser utilizada dessa forma estranha
return inner;
}
var add5 = sum( 5 );
// Module Pattern
// If not an IIFE, it's contents can be read as a string
var Exposer = (function () {
// Everything here is private
var private = 'contents';
// Everything here is public
return {
public: function() {
console.log(private);
class ImageResizer {
constructor(minWidth, minHeight) {
this.minWidth = minWidth;
this.minHeight = minHeight;
this.imageDimension = [1000, 500];
this.imageProportion = this.imageDimension[0] / this.imageDimension[1];
}
resize() {
const defaultArr = [
{ day: 1, from: undefined, to: undefined },
{ day: 2, from: undefined, to: undefined },
{ day: 3, from: undefined, to: undefined },
{ day: 4, from: undefined, to: undefined },
{ day: 5, from: undefined, to: undefined },
{ day: 6, from: undefined, to: undefined },
{ day: 7, from: undefined, to: undefined }
];
@pedrobritto
pedrobritto / webpack.config.js
Created September 25, 2019 12:25
webpack config for storybook (absolute paths and css modules)
const path = require('path');
module.exports = ({config}) => {
config.module.rules.push({
test: /\.scss$/,
loaders: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
######################
## Antigen Settings ##
######################
# Source Antigen
source $HOME/antigen.zsh
antigen use oh-my-zsh
antigen bundle git
@pedrobritto
pedrobritto / palindromic-numbers.js
Last active July 15, 2021 13:04
1) Generate Palindromic numbers and 2) In a list of numbers, get multiples of a given number
function makePalindromicNumber(number) {
const regularNumber = number.toString();
const reversedNumber = number.toString().split("").reverse().join("");
return Number(`${regularNumber}${reversedNumber}`);
}
function generatePalindromicNumberList(digits = 2) {
if (digits < 1) {
throw new Error("'digits' should be equal or greater than '1'.");