Skip to content

Instantly share code, notes, and snippets.

Alberto Restifo albertorestifo

Block or report user

Report or block albertorestifo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Title.js
import React from 'react';
const style = {
title: {
fontSize: '24px',
fontWeight: 'bold',
marginTop: '5px',
marginBottom: '10px',
albertorestifo / propdiff.js
Created Apr 12, 2017
Logs the diff between current and previous props on a react element
View propdiff.js
componentDidUpdate(prevProps) {
console.log('Rrow update diff:');
const now = Object.entries(this.props);
const added = now.filter(([key, val]) => {
if (prevProps[key] === undefined) return true;
if (prevProps[key] !== val) {
- ${JSON.stringify(val)}
View structure.txt
├── index.js
└── src/
├── App.js
├── elements/
albertorestifo / flatten.js
Created May 1, 2016
Multi-level flatten function
View flatten.js
var flatten = arr => arr.reduce((p, c) => p.concat(Array.isArray(c) ? flatten(c) : c), []);
* Credit goes to Benjamin Gruenbaum, from his comment on this article:
# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
albertorestifo / populateMap.js
Last active Aug 26, 2015
Transform a nested object insto a nested Map object
View populateMap.js
* Populate a map with the values of an object with nested maps
* @param {Map} map - Map to populate
* @param {object} object - Object to use for the population
* @param {array} keys - Array of keys of the object
* @return {Map} Populated map
function populateMap (map, object, keys) {
albertorestifo / .zshrc
Last active Dec 5, 2018
New Mac setup and bootstrapping
View .zshrc
# Path to the Oh-my-zsh install
export ZSH=$HOME/.oh-my-zsh
# Add all the required portions to the PATH
export PATH="/usr/local/opt/ruby/bin:$HOME/bin:$PATH";
# Source NVM
source ~/.nvm/
# ZSH Configurations
You can’t perform that action at this time.