Tested under webpack-dev-server 1.7.0.
- Clone this gist
npm install
npm start
- Visit http://localhost:8080 (or http://192.168.x.x:8080) on multiple devices
- Edit entry.js and hit save
const { parse, visit, print, Kind, BREAK } = require('graphql/language'); | |
const { buildASTSchema } = require('graphql/utilities'); | |
const { addResolveFunctionsToSchema } = require('graphql-tools'); | |
const Sequelize = require('sequelize'); | |
const { graphql } = require('graphql'); | |
const jexl = require('jexl'); | |
const deepAssign = require('deep-assign'); | |
const { resolver: sequelizeResolver } = require('graphql-sequelize'); | |
const { inspect } = require('util'); |
import React, {createContext, useContext, useRef} from 'react' | |
import PropTypes from 'prop-types' | |
const Id = createContext() | |
const useIdGetter = (prefix = 'id') => { | |
const ref = useRef() | |
if (!ref.current) { | |
const me = {id: 0, get: () => `${prefix}-${me.id++}`} | |
ref.current = me |
<?xml version="1.0"?> | |
<root> | |
<devicevendordef> | |
<vendorname>WT</vendorname> | |
<vendorid>0x000d</vendorid> | |
</devicevendordef> | |
<deviceproductdef> | |
<productname>TB</productname> | |
<productid>0x0000</productid> |
.SVGIcon { | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
/* fix webkit/blink poor rendering issues */ | |
transform: translate3d(0,0,0); | |
/* it's better defined directly because of the cascade shit | |
width: inherit; | |
height: inherit; |
Tested under webpack-dev-server 1.7.0.
npm install
npm start
import DataLoader from 'dataloader' | |
import {graphqlExpress} from 'graphql-server-express' | |
import schema from './schema' | |
import db from './database' | |
const contextFromReq = req => { | |
const {session} = req | |
const loaders = {} | |
const getLoader = (id, makeGetter) => { |
import React, {Component, PropTypes} from 'react' | |
import {Link, Route as OrigRoute, Switch, Redirect, BrowserRouter as Router, withRouter} from 'react-router-dom' | |
// Subscribes a child to history updates, passing the current location as a prop | |
// This is needed to work around the React context API not updating all children | |
// See https://github.com/ReactTraining/react-router/issues/4629#issuecomment-284218493 | |
export class LocationListener extends Component { | |
static contextTypes = { | |
history: PropTypes.object, | |
} |
export default function withMutation({name, args}) { | |
let mutation; | |
if (args) { | |
const args1 = _.map(args, (type, name) => `$${name}: ${type}`); // e.g. $url: String | |
const args2 = _.map(args, (type, name) => `${name}: $${name}`); // e.g. $url: url | |
mutation = ` | |
mutation ${name}(${args1}) { | |
${name}(${args2}) |
// Based on https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7 | |
const serializeDate = value => { | |
if (value instanceof Date) { | |
return value.toJSON().slice(0, 10) | |
} else if (typeof value === 'number') { | |
return Math.trunc(value) | |
} else if (typeof value === 'string') { | |
return (new Date(value)).toJSON().slice(0, 10) | |
} | |
return null |
on run | |
-- Figure out if we want to do the cd (doIt) | |
-- Figure out what the path is and quote it (myPath) | |
set doIt to false | |
try | |
tell application "Finder" to set doIt to frontmost | |
set myPath to finder_path() | |
if myPath is equal to "" then | |
set doIt to false | |
else |