Skip to content

Instantly share code, notes, and snippets.

View thebergamo's full-sized avatar
🤟

Marcos Bérgamo thebergamo

🤟
View GitHub Profile
type IfStatNode struct {
Condition Node
ThenBranch Node
ElseBranch Node
}
func (n *IfStatNode) Interpret(i *Interpreter) (Node, error) {
conditionNode, err := n.Condition.Interpret(i)
if err != nil {
return nil, err
interface DHeap {
heap: number[];
breadth: number;
}
export function buildDHeap(breadth: number): DHeap {
return {
heap: [],
breadth,
};
.ngmp18 {
background-color: #fff;
overflow: hidden;
width: 100%;
height: 100%;
position: relative;
}
.ngmp18__hw3 {
color: #333;
@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 / README.md
Created November 29, 2016 00:12
Shortcut for start/stop brew services

SS & SP for brew services

How to use

Copy the files above to /usr/local/bin and execute the command chown +x ss sp

For use it just:

starting a service ~> ss mongodb stoping a service ~> sp service

@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
@thebergamo
thebergamo / README.md
Created April 2, 2016 17:06
Fullscreen Terminal on Mac

fs

Just make your terminal using fullscreen with a single command.

Get Started

To make this script works just follow the steps bellow.

  1. Create a file called fs
  2. Paste the content above (the other file in this gist) in the file fs
  3. Give powers to the script chown +x fs (in some cases sudo is required).
  4. Move the file to /usr/local/bin with the command cp fs /usr/local/bin
// [GET] /category
function list (request, reply) {
this.model
.scope({
method: ['user', request.auth.credentials.id]
})
.findAndCountAll({
attributes: ['id', 'description'],
order: 'description',
offset: request.offset,
var Path = require('path');
var Request = require('request-promise');
var Webpack = require('webpack');
var _ = require('lodash');
var LIST_MODULES_URL = 'https://webtask.it.auth0.com/api/run/wt-tehsis-gmail_com-1?key=eyJhbGciOiJIUzI1NiIsImtpZCI6IjIifQ.eyJqdGkiOiJmZGZiOWU2MjQ0YjQ0YWYyYjc2YzAwNGU1NjgwOGIxNCIsImlhdCI6MTQzMDMyNjc4MiwiY2EiOlsiZDQ3ZDNiMzRkMmI3NGEwZDljYzgwOTg3OGQ3MWQ4Y2QiXSwiZGQiOjAsInVybCI6Imh0dHA6Ly90ZWhzaXMuZ2l0aHViLmlvL3dlYnRhc2tpby1jYW5pcmVxdWlyZS90YXNrcy9saXN0X21vZHVsZXMuanMiLCJ0ZW4iOiIvXnd0LXRlaHNpcy1nbWFpbF9jb20tWzAtMV0kLyJ9.MJqAB9mgs57tQTWtRuZRj6NCbzXxZcXCASYGISk3Q6c';
module.exports = Request.get(LIST_MODULES_URL, { json: true }).then(function (data) {
var modules = data.modules;