Skip to content

Instantly share code, notes, and snippets.

View ncuillery's full-sized avatar

Nicolas Cuillery ncuillery

View GitHub Profile
@ncuillery
ncuillery / eslint.js
Created September 4, 2017 21:54
Medium buddybuild/ESLint
[
{
"filePath": "\/Users\/ncuillery\/Dev\/M6\/app-foosby\/src\/stats\/statsActions.js",
"messages": [],
"errorCount": 0,
"warningCount": 0
},
{
"filePath": "\/Users\/ncuillery\/Dev\/M6\/app-foosby\/src\/stats\/statsEpics.js",
"messages": [
@ncuillery
ncuillery / jest.js
Last active September 4, 2017 21:27
Medium buddybuild/ESLint
{
"numFailedTestSuites": 1,
"numFailedTests": 1,
"numPassedTestSuites": 13,
"numPassedTests": 98,
"numPendingTestSuites": 0,
"numPendingTests": 0,
"numRuntimeErrorTestSuites": 0,
"numTotalTestSuites": 14,
"numTotalTests": 99,
@ncuillery
ncuillery / buddybuild_postbuild.sh
Last active September 4, 2017 20:06
Medium buddybuild/ESLint
# Using React Native, this file lies in the platform subdirectory
cd ..
# Create the directory expected by buddybuild
mkdir -p buddybuild_artifacts/Jest
# Run Jest command
jest --outputFile=buddybuild_artifacts/Jest/jest.json --json || exit 1
@ncuillery
ncuillery / ReactEurope2017_5.js
Last active July 16, 2017 06:57
ReactEurope2017_5
const withLoader = Component => props => {
if (!props.ready) {
return <Loader />;
}
return <Component {...props} />;
}
// Usage in the previous example:
const enhance = compose(
@ncuillery
ncuillery / index.android.js
Created March 8, 2017 21:03
Issue RN 11809 Test app
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Animated,
Text,
Image,
View,
ListView,
TouchableWithoutFeedback,
@ncuillery
ncuillery / npm_issue.md
Last active May 29, 2017 15:51
Child process is exited prematurely when running a view command

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

When using NPM 5: if I run the npm view command in a child process (either exec or spawn) the child process exits with code 0 right after the reception of the first chunk of data.

@ncuillery
ncuillery / ReactEurope2017_4.js
Created May 23, 2017 13:29
ReactEurope2017_4
// Instead of doing this...
const EnhancedComponent = connect(commentSelector)(withRouter(WrappedComponent))
// ... you can use a function composition utility
// compose(f, g, h) is the same as (...args) => f(g(h(...args)))
const enhance = compose(
// These are both single-argument HOCs
connect(commentSelector),
withRouter
)
@ncuillery
ncuillery / ReactEurope2017_3.js
Last active May 23, 2017 13:25
ReactEurope2017_3
const names = compose(
map(person => person.name),
sortBy(person => person.age),
filter(person => person.age < 30)
)(persons);
// In opposite to lodash/fp/compose, lodash/fp/pipe preserves the chain order:
const names = pipe(
filter(person => person.age < 30),
sortBy(person => person.age),
@ncuillery
ncuillery / ReactEurope2017_Leland_1.js
Created May 21, 2017 16:25
ReactEurope2017_Leland_1
import { View } from 'react-native';
@ncuillery
ncuillery / ReactEurope2017_2.js
Created May 21, 2017 15:29
ReactEurope2017_2
const names = _.chain(persons)
.filter(person => person.age < 30)
.sortBy(person => person.age)
.map(person => person.name)
.value();