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 / .firebaserc
Created April 10, 2019 07:14
Initialaze a Firebase project for Apollo server
{
"projects": {
"default": "the-id-of-your-project"
}
}
@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 / 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 / Controller.scala
Last active October 12, 2015 14:17
Handle query strings in scala
val queryString = {request.queryString.filter(_._2.exists(_.nonEmpty)).map { p =>
"%s=%s".format(p._1, p._2.head.urlEncoded)
} ++ List(s"api-key=$key")}.mkString("&")
@piuccio
piuccio / application-logger.xml
Created September 14, 2015 09:59
Log what happens in AWS
<logger name="com.amazonaws" level="TRACE" />
<logger name="org.apache.http.wire" level="TRACE" />
@piuccio
piuccio / gist:dd38e85e3f3d42ed1acb
Created September 14, 2015 09:50
Log press action on facia tool
val f = FaciaPressQueue.enqueue(PressJob(FrontPath(path), Draft, forceConfigUpdate = Option(true)))
f.onComplete{
case Success(_) => Logger.info("successful queued " + path)
case Failure(t) => Logger.info(s"failed with $path $t")
}
@piuccio
piuccio / adapter.js
Created May 27, 2015 14:14
karma-jspm load only some tests
var filterTests = document.location.search.match(/[\?\&]test=[a-z-\.]+/gi).map(function (test) {
return (test.split('=')[1] + '.spec.js').toLowerCase();
}) || [];
var filterLoadedTests = filterTests.length ? function (spec) {
var found = false;
filterTests.forEach(function (test) {
found = found || spec.toLowerCase().indexOf(test) !== -1;
});
return found;
} : function () {