Skip to content

Instantly share code, notes, and snippets.

View leogoncalves's full-sized avatar
🏠
Working from home

Leonardo Gonçalves leogoncalves

🏠
Working from home
View GitHub Profile
@leogoncalves
leogoncalves / launch.json
Created May 24, 2022 18:22
Default vscode debugger to Nest Applications
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Nest Framework",
"args": [
"${workspaceFolder}/src/main.ts"
],
@leogoncalves
leogoncalves / AnimalsAndInheritance.js
Created July 23, 2020 12:03
Propostas de solução para os exercícios de monitoria em do Resilia em 23 de julho de 2020
// https://www.codewars.com/kata/56f935002e6c0d55fa000d92/train/javascript
class Shark extends Animal {
constructor(name, age, status) {
super(name, age, 0, "shark", status);
}
}
class Cat extends Animal {
constructor(name, age, status) {
super(name, age, 4, "cat", status);
function cakes(recipe, available) {
const recipeItems = Object.keys(recipe);
const storage = Object.keys(available);
let total = []
const hasAllItems = recipeItems.some(function(item){
return storage.indexOf(item) >= 0;
})
console.log(hasAllItems);
@leogoncalves
leogoncalves / reactotron.ts
Created June 8, 2020 18:59
Reactotron configuration file
import Reactotron, { asyncStorage, networking, openInEditor } from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';
const reactotron = Reactotron.configure({
name: 'App',
host: 'localhost',
})
.use(asyncStorage({}))
.use(openInEditor())
.use(reactotronRedux())
%{
#include <string>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
extern "C" int yylex();
@leogoncalves
leogoncalves / PC.java
Created November 7, 2019 18:00
LAB 11 Comp Conc
/* Disciplina: Computacao Concorrente */
/* Prof.: Silvana Rossetto */
/* Laboratório: 11 */
/* Codigo: Produtor/consumidor em Java */
/* -------------------------------------------------------------------*/
import java.util.*;
// Monitor
class Buffer {
static final int N = 10; //tamanho do buffer
all: leitorescritor
./leitorescritor
barrier:
gcc barreira.c -o barreira -lpthread -Wall -lm
leitorescritor:
gcc leitorescritor.c -o leitorescritor -lpthread -Wall -lm
@leogoncalves
leogoncalves / scan.lex
Last active September 10, 2019 14:27
Analisador léxicos simples
/* Coloque aqui definições regulares */
D [0-9]
L [A-Za-z_]
INI_COMMENT "/*"
END_COMMENT "/*"
/* Identificador, ex: a b _1 ab1 $tab _$5 */
ID ({L}|[$])([$]|{L}|{D})*
@leogoncalves
leogoncalves / calculate_pi.c
Last active September 5, 2019 17:57
Laboratório 4 - Computação Concorrente UFRJ 2019-2 | run as gcc calculate_pi.c -o calculate_pi -Wall -lm -lpthread
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <math.h>
#define _USE_MATH_DEFINES
int nthreads;
long double calculatePiSequencial(long long int quantidade_elementos);
@leogoncalves
leogoncalves / cloudSettings
Last active January 31, 2019 03:14
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-01-31T03:14:50.070Z","extensionVersion":"v3.2.4"}