Skip to content

Instantly share code, notes, and snippets.

View kirkness's full-sized avatar
😎

Henry kirkness

😎
View GitHub Profile
@kirkness
kirkness / csv-to-json.js
Created April 12, 2018 17:32
Convert CSV to JSON
const csvToJson = csv => {
const [firstLine, ...lines] = csv.split('\n');
return lines.map(line =>
firstLine.split(',').reduce(
(curr, next, index) => ({
...curr,
[next]: line.split(',')[index],
}),
{}
)
@kirkness
kirkness / example.js
Last active April 10, 2018 22:07
Example Expobook setup for Medium article
import React from 'react';
import createExpo from 'expobook';
import Button from './components/button';
const expobook = createExpo();
expobook.add('My button', () => <Button>Hello World</Button>);
expobook.add('My other button', () => <Button>Hello World, again</Button>);
export default expobook.build();
@kirkness
kirkness / F*#!ng Gradle
Created November 15, 2017 16:57
Couple of tips for for debugging dependency conflicts.
### TIP 1
Get list of transitive dependencies.
NOTE: Make sure the second tip is not set if you want to see the full result of this.
```
$ cd android
$ ./gradlew :app:dependencies
```
### TIP 2
@kirkness
kirkness / auth-graph.js
Last active August 2, 2017 21:46
Authenticate a GraphQL Schema
// @flow
import { forEachField } from 'graphql-tools';
import { get } from 'lodash/fp';
export default (schema: Object) => {
forEachField(schema, (field: Object) => {
if (field.authenticate) {
// eslint-disable-next-line no-param-reassign
field.resolve = (...args) => {
const [,, context] = args;