start new:
tmux
start new with session name:
tmux new -s myname
import mongoose from 'mongoose'; | |
let schema = new mongoose.Schema({ | |
email: { type: String, required: true, unique: true }, | |
password: { type: String, required: true } | |
}); | |
schema.statics.findOrCreate = async (conditions, opt_attr) => { | |
let document = await User.findOne(conditions); |
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
import React, { Component } from 'react' | |
import { Link } from 'react-router' | |
// Drag and Drop | |
import { DragDropContext } from 'react-dnd' | |
import HTML5Backend from 'react-dnd-html5-backend' | |
// Material UI | |
import { List } from 'material-ui/List' | |
import Subheader from 'material-ui/Subheader' | |
class ReorderableList extends Component { |
import { parse, visit, print } = from 'graphql/language'; | |
/** | |
* Combine the fields of two or more AST nodes, does no error checking! | |
* @param types An array with types to combine. | |
* @returns {*} | |
*/ | |
export function combineASTTypes(types) { | |
return types.reduce((p, n) => Object.assign(p, n, { fields: n.fields.concat(p.fields || []) }), {}); | |
} |
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, { PureComponent } from 'react' | |
import Grid from 'material-ui/Grid' | |
import { CardNumberElement, CardExpiryElement, CardCVCElement } from 'react-stripe-elements' | |
import StripeElementWrapper from './StripeElementWrapper' | |
export default class extends PureComponent { | |
static displayName = 'StripeCardsSection' |
Feel free to contact me at [email protected] or tweet at me @statisticsftw
This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!
It assumes some knowledge of AWS.