Skip to content

Instantly share code, notes, and snippets.

:octocat:
Time for a change

Fabio Crisci piuccio

:octocat:
Time for a change
Block or report user

Report or block piuccio

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
@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 / config.js
Last active Apr 10, 2019
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 / 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 / Controller.scala
Last active Oct 12, 2015
Handle query strings in scala
View Controller.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 Sep 14, 2015
Log what happens in AWS
View application-logger.xml
<logger name="com.amazonaws" level="TRACE" />
<logger name="org.apache.http.wire" level="TRACE" />
@piuccio
piuccio / gist:dd38e85e3f3d42ed1acb
Created Sep 14, 2015
Log press action on facia tool
View gist:dd38e85e3f3d42ed1acb
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
karma-jspm load only some tests
View adapter.js
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 () {
You can’t perform that action at this time.