Skip to content

Instantly share code, notes, and snippets.

View santospatrick's full-sized avatar
👽
Javascripting

Patrick Santos Bitonti Teixeira santospatrick

👽
Javascripting
View GitHub Profile
@santospatrick
santospatrick / .gitconfig
Last active October 15, 2018 11:32
Git Aliases
[user]
name = Patrick Santos
email = patrickspteixeira@gmail.com
[credential]
helper = store
[push]
default = simple
[alias]
set-upstream = !git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`
[core]
@santospatrick
santospatrick / terminal-oh-my-zsh.md
Last active June 14, 2024 18:14
Terminal with oh-my-zsh (Linux/Windows/MacOSX)

Terminal with oh-my-zsh (Linux/Windows/MacOSX)

Every step in this tutorial is required for making terminal look as the image below.

ZSH & OH-MY-ZSH

sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@santospatrick
santospatrick / README.md
Created August 28, 2017 14:43 — forked from thgaskell/README.md
Sequelize + Express Starter Guide
import removeAccents from 'remove-accents';
/**
* Filter list based on certain attribute by some text
* @param {array} list
* @param {string} searchText
* @param {string} attribute
* @returns {array} new filtered list
*/
export function filterList(list, searchText, attribute) {
/**
* Get cultures name into a new array
* Immutable, pure
* @param {Array} cultures
* @returns {Array<String>}
*/
const getNames = cultures => cultures.map(item => item.cultureName);
/**
* Get cultures quantity summed into
const cultures = [
{
cultureName: 'Soybean',
quantity: 1500.50,
calories: 446,
energy: {
quantity: 0,
unit: 'g'
}
},
const names = cultures.map(item => item.cultureName)
// ['Soybean', 'Maize', 'Wheat']
const energies = cultures
.reduce((acc, nextObject) => {
const nextValue = nextObject.energy.quantity;
const currentValue = acc[nextObject.energy.unit]
? acc[nextObject.energy.unit].quantity
: 0;
acc[nextObject.energy.unit] = {
/**
* Pure javascript responsability:
* http to get cultures then add it to
* 'cultures' variable and then reuse
* the transformers we wrote
*/
// Vue.js
<ul>
<li v-for="item in getNames(cultures)">{{ item }}</li>
/**
* Redux action to store cultures
* @param {Array<Object>} arr
* @returns {Object}
*/
export const reduxAction = arr => ({
type: 'ADD_CULTURES',
cultures: arr
});
/**
* React
*/
import React from 'react';
import PropTypes from 'prop-types';
/**
* Generic
*/
import areIntlLocalesSupported from 'intl-locales-supported';