Skip to content

Instantly share code, notes, and snippets.

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

Gustavo Mauricio de Barros gumbarros

🏠
Working from home
View GitHub Profile
@gumbarros
gumbarros / router_example.js
Last active February 8, 2022 16:34
Router Example
router.route("/products/:id?")
.get( (request, response) => ProductController.getProductById(request, response))
.post( (request,response) => ProductController.newProduct(request, response))
.patch( async (request, response) => await ProductController.updateProductById(request, response))
.delete( (request, response) => ProductController.deleteProductById(request, response));
@gumbarros
gumbarros / nested_namespaces.js
Created December 8, 2021 14:05
Nested Namespaces - 2021
var fs = require('fs');
var yaml = require('js-yaml');
var toc = yaml.load(fs.readFileSync('./api/toc.yml'));
var namespaces = {};
for (var i = 0; i < toc.length; i++) {
var fullnamespace = toc[i].uid;
var splitnamespace = fullnamespace.split('.');
@gumbarros
gumbarros / paging_controller_hook.dart
Last active April 26, 2023 21:14
Flutter Infinite Scroll Pagination Hook
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
typedef PaginatedDataFunction = Function({required int currentPage});
usePagingController<T>(PaginatedDataFunction paginatedDataFunction,
{List<Object?>? keys}) {
return use(_PagingControllerHook<T>(paginatedDataFunction, keys));
}
@gumbarros
gumbarros / FlagsVsOptions.cs
Created June 2, 2024 19:45
Benchmark of ways of checking enum flags
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Mathematics;
namespace Benchmark;
/// <summary>
/// Options used for both parsing and evaluation of an expression.
/// </summary>
[Flags]
using System.Collections.Frozen;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
namespace NCalc.Benchmarks;
public class ExampleExpression
{
public Dictionary<string, Func<Task<object>>> TaskDictionary;