Skip to content

Instantly share code, notes, and snippets.

View thebergamo's full-sized avatar
🤟

Marcos Bérgamo thebergamo

🤟
View GitHub Profile
@thebergamo
thebergamo / realworld.graphql
Last active November 10, 2017 16:56 — forked from steveluscher/realworld.graphql
The schema for thebergamo/realworld-graphql
### Articles
type Article {
author: Profile!
body: String!
comments(first: Int, after: String): CommentsConnection
createdAt: String!
description: String!
favorited: Boolean!
favoritesCount: Int!
slug: String!
@thebergamo
thebergamo / ad.js
Created May 31, 2016 14:16 — forked from rbezerra/ad.js
ad.findUserAsync(login)
.then(function(user){
return ad.authenticateAsync(user.mail, password);
})
.then(function(auth){
if(!auth) res.status(403).send({"message": "user not authenticated"});
res.status(200).send({"message": "user authenticated","data": user});
})
.catch(function(err){
return next(err);
@thebergamo
thebergamo / controller.js
Last active April 7, 2016 20:11
Update valor total
//item-order --> esse json que é enviado no POST
{
"order": 1,
"product": 1,
"price": 10,
"quantity": 20
}
// [POST] /item-order
// [GET] /category
function list (request, reply) {
this.model
.scope({
method: ['user', request.auth.credentials.id]
})
.findAndCountAll({
attributes: ['id', 'description'],
order: 'description',
offset: request.offset,
express.get('/', function(req, res){
http.get('www.outrolugar.com.br/api/', function(err, response){
if(err)
res.end(err);
res.end(resp.body);
})
})
@thebergamo
thebergamo / gitme.sh
Last active August 29, 2015 14:11 — forked from alanhoff/gitme.sh
#!/bin/bash
echo "-- PULL before Commit! --"
git pull
echo "-- Commiting --"
git add . --all
git commit -am "$3"
echo "-- Sending PUSH! "
git push -u $1 $2
@thebergamo
thebergamo / mundo.js
Last active August 29, 2015 14:06 — forked from paulohp/mundo.js
// module
exports.makePaulo = function (cb) {
var ret = {valid: false, data = ''};
request('http://blaablablablbla', function(err, res, body){
ret.valid = true;
return ret;
});
};
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res) {
res.sendfile('index.html');
});
io.on('connection', function(socket) {
console.log('um usuario conectado');