Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View gabrielsimas's full-sized avatar
💭
Always happy and ready to coding the World!

Gabriel Simas gabrielsimas

💭
Always happy and ready to coding the World!
View GitHub Profile
using System;
using System.Threading.Tasks;
namespace System.Collections.Concurrent
{
public static class ConcurrentDictionaryExtensions
{
/// <summary>
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>.
/// </summary>
@LeyTT
LeyTT / tabelas_sinacor
Created April 2, 2020 14:45
Tabelas Sinacor
Prefixo das Tabelas
TSC = Clientes
TCC = Conta Corrente
TTS = Tesouraria
TOR = Ordens Bolsa
TBO = Faturamento Bolsa
TCA = Controle de Acesso
TMF = Faturamento de BM&F
TCF = Custodia
TGE = Controle de Empresas
@russcam
russcam / completion-suggester.cs
Last active November 1, 2021 00:52
Using Completion Suggester with NEST
void Main()
{
var indexName = "stackoverflow";
var node = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionSettings(node)
.InferMappingFor<Question>(m => m
.IndexName(indexName)
)
.PrettyJson()
.DisableDirectStreaming()
@rdakar
rdakar / Validação de CPF e CNPJ - C#
Created August 14, 2017 21:02
Validação de CPF e CNPJ - C#
namespace CpfCnpj
{
public static class CpfCnpjUtils
{
public static bool IsValid(string cpfCnpj)
{
return (IsCpf(cpfCnpj) || IsCnpj(cpfCnpj));
}
private static bool IsCpf(string cpf)
@quangnd
quangnd / reduceExamples.js
Last active November 24, 2023 19:57
Some examples about reduce() in Javascript
//Example 1 - Calculate average value of an array (transform array into a single number)
var scores = [89, 76, 47, 95]
var initialValue = 0
var reducer = function (accumulator, item) {
return accumulator + item
}
var total = scores.reduce(reducer, initialValue)
var average = total / scores.length
/*Explain about function
@OllieJones
OllieJones / DataTableResultSet.cs
Last active March 3, 2023 22:16
C# code for handling Ajax calls for the DataTables.net client table-rendering plugin.
/// <summary>
/// Resultset to be JSON stringified and set back to client.
/// </summary>
[Serializable]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class DataTableResultSet
{
/// <summary>Array of records. Each element of the array is itself an array of columns</summary>
public List<List<string>> data = new List<List<string>>();
@ghinda
ghinda / git-commit-csv-export.sh
Last active October 17, 2023 10:16
git csv export of commits in the last month
git log --since='last month' --pretty=format:'%h;%an;%ad;%s' --author='Ionut Colceriu' > ~/log.csv
@jsauve
jsauve / AsyncDapperDemo.cs
Last active August 18, 2023 17:58
Async Dapper Demo. Includes buffered and non-buffered connection helpers.
using System;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
using Dapper;
public class Program
{
public static void Main()
@k4ml
k4ml / messaging.py
Created January 29, 2014 23:26
POPO - Plain Old Python Object
class Messaging(object):
def __init__(self, user, sender, receiver, message):
self.user = user
self.sender = sender
self.receiver = receiver
self.message = message
def send(self):
required_points = self.get_required_points()
if required_points > self.user.points: