This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PageList = () => { | |
const [value, setValue] = React.useState('') | |
usePusher('pageAdded', ({ client, data }) => { | |
// client is an instance of ApolloClient | |
let { pages } = client.readQuery({ query, variables }) | |
pages = [data, ...pages] | |
client.writeQuery({ query, variables, data: { pages } }) | |
}) | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useDispatch, StoreProvider } from "@/state/store" | |
import mockClient from "@/tests/mocks/mockClient" | |
import { UserQuery } from "@graphql/user/queries.graphql" | |
let r, data, dispatch | |
const DispatchWrapper = props => { | |
dispatch = useDispatch() | |
return props.children | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react" | |
import usePrefetchQuery from "./usePrefetchQuery.js" | |
import {SomeGraphQlQuery} from "./queries.gql" | |
import List from "./List" | |
const SomeComponent = props => { | |
const [prefetch, setPrefetch] = useState(false) | |
const { data, loading } = usePrefetchQuery({query: SomeGraphQlQuery})(prefetch) | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gets directory names from a path, excluding blacklisted names. Returns an array of strings. | |
exports.getFiles = (path, config) => async (req, res) => { | |
const files = await readdir(path) | |
const filteredFiles = filterThroughBlacklist(files) | |
res.send({ files: filteredFiles, config }) | |
} | |
// Gets README content for package and all first-level children. | |
exports.getPackage = path => async (req, res) => { | |
const name = req.params.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
const pipe = require("lodash/fp/pipe") | |
const some = require("lodash/some") | |
const promisify = require("util").promisify | |
const readdir = promisify(fs.readdir) | |
const readFile = promisify(fs.readFile) | |
// directories to exclude from the search | |
const blacklist = [".bin", ".cache", ".yarn-integrity"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express") | |
const webpack = require("webpack") | |
const config = require("../webpack.config") | |
const devMiddleware = require("webpack-dev-middleware") | |
const compiler = webpack(config) | |
const bodyParser = require("body-parser") | |
// controller to handle API requests | |
const FileController = require("./controllers") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const program = require("commander") | |
const makeServer = require("./server/serve") | |
const path = require("path") | |
// gets the config file from the working directory of the application | |
const getConfig = () => { | |
const configPath = path.join(process.cwd(), "./module-docs.config.js") | |
const config = require(configPath) | |
return config ? config || null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const vscode = require("vscode"); | |
const editor = vscode.window.activeTextEditor; | |
const rp = require("request-promise"); | |
async function CreateGist() { | |
const text = editor.document.getText(editor.selection); | |
// User Input to name Gist file | |
const gistName = await vscode.window.showInputBox({ | |
placeHolder: "Name Your GistTest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"contributes": { | |
"commands": [ | |
{ | |
"command": "extension.createGist", | |
"title": "Create Gist" | |
} | |
], | |
"menus": { | |
"editor/context": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"contributes": { | |
"commands": [ | |
{ | |
"command": "extension.createGist", | |
"title": "Create Gist" | |
} | |
], | |
"menus": { | |
"editor/context": [ | |
{ |
NewerOlder