This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef struct stack { | |
int size; | |
char value[64]; | |
} Stack; | |
void push(struct stack *s, char c){ | |
s->value[s->size] = c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct LNode { | |
int data; | |
LNode* next; | |
LNode(int n){data = n; next = NULL;} | |
void add_to_end(int n) { | |
if (next) | |
next->add_to_end(n); | |
else | |
next = new LNode(n); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bubble(vector): | |
fim = len(vector) | |
for i in (fim-1, 0, -1): | |
for j in (0, i): | |
if vector[j] > vector[j+1]: | |
vector[j], vector[j+1] = vector[j+1], vector[j] | |
# O Algoritmo bubble sort tem o intuito de ordenar os itens do pesado para o mais leve, por isso o for comeca iterando o vetor todo | |
# e depois ele itera o vetor-1, porque o vector+1 ja esta o item mais pesado |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="header-cart middle-same"> | |
<button class="icon-cart"> | |
<i class="pe-7s-shopbag cart-bag"></i> | |
<span | |
class="count-amount" | |
id="count-amount" | |
>{{ sumCart | toReal }}</span> | |
<i class="ion-chevron-down cart-down"></i> | |
<span class="count-style">{{ itemsCart.length }}</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Category implements IRecord { | |
id: ID! | |
products: [Product]! | |
category_name: String! | |
created_at: String! | |
updated_at: String | |
} | |
type CategoriesResource implements IResource { | |
pagination: Pagination! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (fastify, opts, next) => { | |
console.log(fastify.configuration) // { db: 'alguma-database', port: 800 } | |
fastify.decorate('configurationPlugin1', { | |
name: 'plugin1' | |
}) | |
console.log(fastify.configurationPlugin1) // { name: 'plugin1' } | |
next() // Nunca se esqueça de liberar esse handler com `next`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fastify = require('fastify')() | |
// Registrando o Swagger | |
fastify.register(require('fastify-swagger'), { | |
routePrefix: '/docs', // Rota para acessar a UI do Swagger | |
exposeRoute: true, | |
swagger: { | |
host: 'localhost:3000', | |
schemes: ['http'], | |
consumes: ['application/json'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fastify = require('fastify')() | |
fastify.decorate('configuration', { | |
db: 'alguma-database', | |
port: 800 | |
}) | |
//Plugin1 | |
fastify.register(require('./plugin1.js')) | |
//Plugin2 | |
fastify.register(require('./plugin2.js')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const amqp = require('amqplib') | |
async function createConnection (uri = 'guest:guest@localhost:5672') { | |
const connection = await amqp.connect('amqp://' + uri) | |
return connection | |
} | |
createConnection() | |
.then(conn => conn.createChannel()) | |
.then(ch => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const amqp = require('amqplib') | |
async function createConnection (uri = 'guest:guest@localhost:5672') { | |
const connection = await amqp.connect('amqp://' + uri) | |
return connection | |
} | |
createConnection() | |
.then(conn => conn.createChannel()) | |
.then(ch => { |
OlderNewer