Skip to content

Instantly share code, notes, and snippets.

View andrewhl's full-sized avatar

Andrew Hlavats andrewhl

View GitHub Profile
export default {
data: [
{
id: 1,
level: 1,
parent_id: null,
children: [ 4,5 ]
},
{
id: 2,
import React, { Component } from 'react';
// Best practice is to use prop-type declarations on all components that receive props.
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom'
import { connect } from 'react-redux'
import { Table, Button, Container, Input, Form } from 'semantic-ui-react';
import RequestRegistryRow from '../components/RequestRegistryRow';
import Layout from '../components/Layout';
renderMenuItems() {
let i = 0;
return this.props.sections.map((section, index) => {
i ++;
return [
<MenuItemTarget
onDrop={this.handleDrop}
position={index - 1}
key={i * 100}
app.post('/articles/:uuid/file', upload.array('file', 2), (req, res, next) => {
const session = driver.session();
let images = [];
let captions = req.body.caption;
const sessionUuid = uuidV4();
req.files.forEach((file, index) => {
images.push(Object.assign({}, {
// Iterate through request files array and write each file to Neo4j
images.forEach(image => {
session.writeTransaction(tx => {
tx.run(`MATCH (n:Article {uuid: $uuid})-[:HAS]->(f:File)
MERGE (n)-[:HAS]->(i:File {
name: $name,
caption: $caption
}) WITH i,n SET i.uuid = $fileUuid,
i.url = $url,
i.updated_at = $updatedAt,
/* @flow */
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Container, Header, Left, Button, Body, Title, Right, Icon, Text } from 'native-base';
import { TouchableWithoutFeedback, Keyboard, Alert } from 'react-native';
import { getFormValues, isPristine, isValid } from 'redux-form';
import AddItemFormContainer from '../../components/AddItemFormContainer';
import * as itemsModule from '../../../../redux/modules/items';
import BackButton from './components/BackButton';
import SubmitButton from './components/SubmitButton';
{
"name": "Top Level One",
"id": "topLevelOne,
"children": [
{
"name": "Stuff",
"id": "topLevelOne.stuff",
"children": [
{
"name": "Things",
//jshint esversion:6
function convertToRoman(num) {
const UNITS = {
1: 'I',
4: 'IV',
5: 'V',
9: 'IX',
10: 'X',
40: 'XL',
(() => {
const range = (num) => {
return [...Array(num).keys()].map(n => n+1)
}
const productEqualsSum = (a, b, number) => {
const sum = ((number * (number+1)) / 2) - (a+b);
return a*b === sum;
}
@andrewhl
andrewhl / 0_reuse_code.js
Created March 27, 2017 21:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console