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
@albertorestifo
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) {
console.log(`${key}
- ${JSON.stringify(val)}
View gist:2cc2bab488a39eb60e0c9faa77250eb4
defaults write com.microsoft.VSCode.helper CGFontRenderingFontSmoothingDisabled -bool NO
@albertorestifo
albertorestifo / sort.js
Created Nov 28, 2017
A quick script to sort by stars
View sort.js
const fs = require('fs');
const rp = require('request-promise');
const Promise = require('bluebird');
const list = fs.readFileSync('./list', { encoding: 'utf8' });
const urls = list.split('\n');
const TOKEN = '<YOUR API TOKEN>';
const repos = urls.map((url) => {
@albertorestifo
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/nvm.sh
# ZSH Configurations
@albertorestifo
albertorestifo / ref.js
Created Nov 6, 2017
Charts In React - Article resources
View ref.js
import React, { Component } from 'react';
import { select } from 'd3-select';
class LineChart extends Component {
componentDidMount() {
this.renderChart();
}
renderChart() {
const svg = select(this.containerEl);
View challenge.go
package main
import (
"bufio"
"fmt"
"log"
"os"
"runtime"
"strings"
"sync"
View createEmail.js
const fs = require('fs');
const Path = require('path');
const React = require('react');
const ReactDOMServer = require('react-dom/server');
const Email = require('../lib/Email').default;
const STYLE_TAG = '%STYLE%';
const CONTENT_TAG = '%CONTENT%';
View package.json.diff
{
"name": "react-emails-example",
"version": "0.1.0",
"private": true,
+ "main": "./server/createEmail.js",
"devDependencies": {
+ "babel-cli": "^6.24.1",
+ "babel-preset-react-app": "^2.2.0",
"react-scripts": "0.9.5"
},
View index.js.diff
import React from 'react';
import ReactDOM from 'react-dom';
+import './inlined.css';
View inlined.css
@media only screen and (max-width: 650px) {
.title-heading {
font-size: 18px !important; /* We need !important to */
text-align: center !important; /* overcome inline styles */
}
}
You can’t perform that action at this time.