Skip to content

Instantly share code, notes, and snippets.

View piuccio's full-sized avatar
:octocat:
Time for a change

Fabio Crisci piuccio

:octocat:
Time for a change
View GitHub Profile
@piuccio
piuccio / config.js
Last active November 16, 2020 15:05
Shared code to run local apollo server next to firebase functions
const gql = require('graphql-tag');
const { makeExecutableSchema } = require('graphql-tools');
const books = [
// ...
];
const typeDefs = gql`
# ...
`;
@piuccio
piuccio / .firebaserc
Created April 10, 2019 07:14
Initialaze a Firebase project for Apollo server
{
"projects": {
"default": "the-id-of-your-project"
}
}
@piuccio
piuccio / index.js
Created April 10, 2019 07:03
Sample server from apollo-server documentation
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books we'll be able to query
// the GraphQL server for. A more complete example might fetch
// from an existing data source like a REST API or database.
const books = [
{
title: 'Harry Potter and the Chamber of Secrets',
author: 'J.K. Rowling',
},
language: node_js
node_js:
- '8'
- '10'
cache: npm
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2019
},
"env": {
"node": true,
"es6": true
},
"overrides": [{
'a'.charCodeAt(0);
// 97
Buffer.from('a').toString('hex')
// 61
@piuccio
piuccio / console.js
Created February 7, 2013 08:57
hashspace Event listeners on scope objects
// Click on the fruit name toggles the fruit's edible property
@piuccio
piuccio / console.js
Created February 6, 2013 19:16
hashspace Event callbacks as literals
// Event callbacks don't need a refresh, they trigger one automatically
log();
@piuccio
piuccio / console.js
Last active December 12, 2015 05:28
hashspace Foreach loop and json interaction
// The model is accessible with the name `vscope`
//
// `json` has also methods to handle arrays
// - push
// - splice
// - shift
json.push(vscope.things, "Mangos");
log();
hsp.refresh();
@piuccio
piuccio / console.js
Last active December 12, 2015 05:28
hashspace Basic template insert
// The model is accessible with the name `vscope`
// To refresh a template, call `refresh()`
json.set(vscope, "message", 'Have a nice refresh.');
log();
hsp.refresh();