Skip to content

Instantly share code, notes, and snippets.

View gabrielhpugliese's full-sized avatar

Gabriel Pugliese gabrielhpugliese

View GitHub Profile
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
try {
root.find(j.JSXSpreadAttribute)
.forEach(path => {
const spreadProps = path.node.argument;
if (!spreadProps.properties) return;
{
heating: [
{
cost: 4.11,
date: 'Di.'
},
{
cost: 4.11,
date: 'Mi.'
},
04ea31fa598b02dcad3fff9b55f7bbae770728a192332fddb5e22e77bfac37cf73c767a571926b42588715d45c13dde1e27b79c5e0dca9c802d1709f718bcdd430;rabc
import {
compose,
findIndex,
pullAt,
curry,
} from 'lodash/fp';
const MY_LIST = [/* items here */];
const removeFromList = curry((itemToRemove, list) => compose(
import {
compose,
findIndex,
cond,
} from 'lodash/fp';
const MY_LIST = [/* items here */];
const findMyItemIndex = findIndex(item => item === 'MY_ITEM');
const changeItemToSomething = () => // returns NEW object (immutable)
import {
compose,
findIndex,
cond,
} from 'lodash/fp';
const MY_LIST = [/* items here */];
const findMyItemIndex = findIndex(item => item === 'MY_ITEM');
const changeItemToSomething = () => // returns NEW object (immutable)
class A {
constructor(){
this.method3 = this.method3.bind(this);
}
method1() {
}
method2 = () => {
}
------------------
System Information
------------------
Serial Number: 9S7179111077ZF5000145
Product Name: GE72 2QF
OS: Microsoft Windows 10 Home 64-bit
Windows Product Key: 8HVX7
HDI Build: non-OEM
BIOS Version: E1791IMS.113
BIOS Release Date: 2016/04/19
> require.extensions['.svg'] = () => 1;
[Function]
> var bla = require('../icons/icon-close.svg')
undefined
> bla
{}
@gabrielhpugliese
gabrielhpugliese / bench.txt
Last active December 13, 2018 16:50
Python 3.4 asyncio + aiohttp parallel vs sequential requests
$python parallel.py
[13:48:59:130701] Doing GET request to http://google.com
[13:48:59:134958] Doing GET request to http://facebook.com
[13:48:59:135498] Doing GET request to http://twitter.com
[13:48:59:136174] Doing GET request to http://slack.com
****** STATUSES: [{'status': 200, 'url': 'http://google.com'}, {'status': 200, 'url': 'http://twitter.com'}, {'status': 200, 'url': 'http://slack.com'}, {'status': 200, 'url': 'http://facebook.com'}]
$python sequential.py
[13:49:04:078752] Doing GET request to http://google.com
[13:49:04:232725] Doing GET request to http://facebook.com