Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Time for a change

Fabio Crisci piuccio

:octocat:
Time for a change
View GitHub Profile
@piuccio
piuccio / config.js
Last active Nov 16, 2020
Shared code to run local apollo server next to firebase functions
View config.js
const gql = require('graphql-tag');
const { makeExecutableSchema } = require('graphql-tools');
const books = [
// ...
];
const typeDefs = gql`
# ...
`;
@piuccio
piuccio / .firebaserc
Created Apr 10, 2019
Initialaze a Firebase project for Apollo server
View .firebaserc
{
"projects": {
"default": "the-id-of-your-project"
}
}
@piuccio
piuccio / index.js
Created Apr 10, 2019
Sample server from apollo-server documentation
View index.js
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',
},
View .travis.yml
language: node_js
node_js:
- '8'
- '10'
cache: npm
View .eslintrc.json
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2019
},
"env": {
"node": true,
"es6": true
},
"overrides": [{
View charCodeAt.js
'a'.charCodeAt(0);
// 97
Buffer.from('a').toString('hex')
// 61
@piuccio
piuccio / console.js
Created Feb 7, 2013
hashspace Event listeners on scope objects
View console.js
// Click on the fruit name toggles the fruit's edible property
@piuccio
piuccio / console.js
Created Feb 6, 2013
hashspace Event callbacks as literals
View console.js
// Event callbacks don't need a refresh, they trigger one automatically
log();
@piuccio
piuccio / console.js
Last active Dec 12, 2015
hashspace Foreach loop and json interaction
View console.js
// 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 Dec 12, 2015
hashspace Basic template insert
View console.js
// 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();
You can’t perform that action at this time.