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
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> |
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
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 |
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
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() |
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
namespace CpfCnpj | |
{ | |
public static class CpfCnpjUtils | |
{ | |
public static bool IsValid(string cpfCnpj) | |
{ | |
return (IsCpf(cpfCnpj) || IsCnpj(cpfCnpj)); | |
} | |
private static bool IsCpf(string cpf) |
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
//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 |
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
/// <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>>(); |
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
git log --since='last month' --pretty=format:'%h;%an;%ad;%s' --author='Ionut Colceriu' > ~/log.csv |
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
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() |
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
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: |
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
import inspect | |
import logging | |
HEADER_FMT = "Call stack at %s, line %d in function %s, frames %d to %d of %d:" | |
"""The log header message formatter.""" | |
STACK_FMT = "%s, line %d in function %s." | |
"""The log stack message formatter.""" | |
def log_stack(logger=None, limit=None, start=0): |
NewerOlder