Skip to content

Instantly share code, notes, and snippets.

View chrisoverstreet's full-sized avatar

Chris Overstreet chrisoverstreet

  • BoomPop, Inc.
  • Lynchburg, VA
  • 13:37 (UTC -12:00)
View GitHub Profile
// @flow
import classnames from 'classnames';
import css from 'styled-jsx/css';
import PropTypes from 'prop-types';
import React from 'react';
import type { Node } from 'react';
import Icon from './Icon';
import Text from './Text';
// @flow
import React from 'react';
import css from 'styled-jsx/css';
import classnames from 'classnames';
import { useDispatch, useSelector } from 'react-redux';
import { useApolloClient } from '@apollo/react-hooks';
import pluralize from 'pluralize';
import PropTypes from 'prop-types';
import userHasLoginRole from '../../utils/userHasLoginRole';
const html = require('pa11y-reporter-html');
const pa11y = require('pa11y');
const fs = require('fs');
const open = require('open');
const [, , url] = process.argv;
(async () => {
console.log(`Signing in as admin user...`);
const results = await pa11y('https://workshop.dev.homee.com/login/internal', {
// @flow
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { useApolloClient } from '@apollo/react-hooks';
import type { Dispatch } from 'redux';
import consumerRequestActions from './consumerRequestActionsMap';
import jobActions from './jobActionsMap';
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
const convertDataToAlgoliaObject = (data) => {
let asin;
let brand;
let categories;
let featured;
let price;
let thumbnail;
data.metafields.forEach((metafield) => {
switch (metafield.key) {
/* eslint-disable no-console */
require('dotenv').config({ path: './.env.production' });
const express = require('express');
const bodyParser = require('body-parser');
const corser = require('corser');
const next = require('next');
const routes = require('./routes');
const algoliasearch = require('algoliasearch');
const convertDataToAlgoliaObject = require('./utils/convertDataToAlgoliaObject');
const fetch = require('isomorphic-fetch');
@chrisoverstreet
chrisoverstreet / actions.js
Last active May 23, 2018 16:01
Cosmic Blog tutorial - Fetch post
const fetchPost = slug => fetch(`${API_URL}/post/${slug}`)
.then(res => res.json())
.then(json => console.log(json));
@chrisoverstreet
chrisoverstreet / server.js
Created May 23, 2018 15:56
Cosmic Blog tutorial - Social Links endpoint
// API endpoint for social links
server.get('/api/social-links', (req, res) => {
const params = {
type: 'social-links',
};
return bucket.getObjects(params)
.then(objects => res.send(objects))
.catch(err => res.status(404).json({
@chrisoverstreet
chrisoverstreet / server.js
Created May 23, 2018 15:54
Cosmic Blog tutorial - API endpoint for site metadata
// API endpoint for site metadata (i.e. title, tag, logo)
server.get('/api/meta', (req, res) => bucket.getObject({ slug: 'header' })
.then(object => res.send(object))
.catch(err => res.status(404).json({
message: 'Error fetching header data',
error: err,
})));