Skip to content

Instantly share code, notes, and snippets.

:octocat:
open sourcy and shit

Sara Vieira SaraVieira

:octocat:
open sourcy and shit
Block or report user

Report or block SaraVieira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SaraVieira
SaraVieira / README.md
Last active Nov 19, 2018 — forked from elijahmanor/README.md
Export @code Extensions to a Markdown List
View README.md

You can run either of the following snippets in your terminal to generate a markdown list of your VS Code extensions.

code-insiders --list-extensions | awk '{ print "* [" $1 "](https://marketplace.visualstudio.com/items\?itemName\=" $1 ")" }'

npx https://gist.github.com/elijahmanor/7f9762a4c2296839ad33e33513e88043

NOTE: You can append | pbcopy to either of the above commands to pipe the output to your Mac's copy/paste buffer.

View users.graphql
{
getUsers(people: 3) {
name {
first
last
},
location {
city
}
}
View users.js
getUsers: async (_, { people }, { dataSources }) =>
dataSources.RandomUser.getUsers(people)
View users.js
async getUsers(people = 10) {
const user = await this.get(`/?results=${people}`);
return user.results;
}
View query.graphql
{
getUser {
name {
first
last
}
}
}
View resolvers.js
const resolvers = {
Query: {
getUser: async (_, __, { dataSources }) => dataSources.RandomUser.getUser()
}
};
View server.js
const server = new ApolloServer({
typeDefs,
resolvers,
dataSources: () => ({
RandomUser: new RandomUser()
})
});
View getUser.js
const { RESTDataSource } = require("apollo-datasource-rest");
class RandomUser extends RESTDataSource {
constructor() {
super();
this.baseURL = "https://randomuser.me/api";
}
async getUser() {
const user = await this.get("/");
View example.js
async getThing(id) {
return this.get(`things/${id}`);
}
View dataSource.js
const { RESTDataSource } = require("apollo-datasource-rest");
class RandomUser extends RESTDataSource {
constructor() {
super();
this.baseURL = "https://randomuser.me/api/";
}
}
module.exports = RandomUser;
You can’t perform that action at this time.