Skip to content

Instantly share code, notes, and snippets.

🤔
Inspired

Matteo Demicheli matteodem

🤔
Inspired
Block or report user

Report or block matteodem

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
@matteodem
matteodem / code.js
Created Nov 7, 2019
Extreme Reusability with Functional Programming & Lodash
View code.js
import { flow, map, get, add, reduce } from 'lodash/fp'
const getScore = get('score')
export const countUserScores = flow(
 map(getScore),
 reduce(add)(0),
)
@matteodem
matteodem / graphlizerSchema.js
Created Mar 1, 2018
Graphqlizer Basic Example
View graphlizerSchema.js
import { crud, generateTypeDefsAndResolvers } from 'meteor/easy:graphqlizer'
import { AlienCollection } from '{...}'
const alienSchema = crud('Alien', AlienCollection)
const { typeDefs, resolvers } = generateTypeDefsAndResolvers({
schemas: [alienSchema],
})
@matteodem
matteodem / powerfulResolver.js
Last active Feb 22, 2018
grapher + graphql + join-mongo example
View powerfulResolver.js
import { Meteor } from 'meteor/meteor'
import transformAstToFieldSpecifiers from 'join-mongo'
const myAwesomeResolver = (args, context, root, ast) => {
return Meteor.users.createQuery({
...transformAstToFieldSpecifiers(ast),
}).fetch()
}
@matteodem
matteodem / ExtendedExample.js
Last active Feb 16, 2018
Graphqlizer vNEXT
View ExtendedExample.js
import { crud, resolvers, resolver, typeDefs, typeDef, generateTypeDefsAndResolvers } from 'meteor/easy:graphqlizer'
import { AlienCollection, AlienSimpleSchema } from '{...}'
const alienSchema = {
typeDefs: [
...typeDefs('Alien', AlienSimpleSchema), // Input and Type
// or cutom
typeDef.input('Alien', MyCustomAlienSchema), // only Input
`
type CustomType {
@matteodem
matteodem / aggregation_multiple.json
Last active Aug 29, 2015
Aggregation - Multiple Values (Elastic Search)
View aggregation_multiple.json
{
...
"aggs": {
...
"label": {
"terms": {
"size": 10,
"shard_size": 0,
"script": "doc['labels.slug'].value"
},
You can’t perform that action at this time.