Skip to content

Instantly share code, notes, and snippets.

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

Elemar Rodrigues Severo Junior ElemarJR

🏠
Working from home
View GitHub Profile
using System;
using NUnit.Framework;
using SharpTestsEx;
namespace WebDirectory.Common.Tests
{
[TestFixture]
public class ThrowTests
using System.Text;
string input = "AABCBAD";
var ft = FrequencyTable.Create(input); // O(n)
var ht = HuffmanTree.Build(ft); // O(m)
var et = EncodedTable.Build(ht); // O(m) => O(n + m)
var compressed = HuffmanCompressor.Compress(input, et);
Console.WriteLine(compressed);
var decompressed = HuffmanDecompressor.Decompress(compressed, ht);
Console.WriteLine(decompressed);
public static class FrequencyTable
{
public static Dictionary<char, int> Create(string input)
{
foreach (char character in input)
{
if (frequencyTable.ContainsKey(character))
{
frequencyTable[character]++;
}
using System;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Collections.Generic;
namespace ParallelDemo
{
class Program
{
static void Main(string[] args)
@ElemarJR
ElemarJR / AnimatedBox.xaml
Created July 19, 2011 01:06
AnimatedBox.xaml
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowTitle="Animated Box"
Title="Animated Box"
Background="#400000">
<Page.Resources>
<!-- Materials for box sides. -->
<DiffuseMaterial x:Key="mat" Brush="Green" />
<DiffuseMaterial x:Key="backmat" Brush="White" />
@ElemarJR
ElemarJR / GettingStarted.cs
Created April 16, 2012 02:43
Selenium WebDriver Basic "Learning" Tests
using System;
using NUnit.Framework;
using SharpTestsEx;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
namespace LearningTests.SeleniumWebDriver
{
[TestFixture]
using System;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using static System.Console;
@ElemarJR
ElemarJR / STATEMENTS.md
Last active December 10, 2017 12:57
My Celebrity Statements

I help senior software engineers and architects to create software that meets business needs so they can have space to innovate and to get recognized for that.

I help C-Level executives to design and implement innovation strategies effectively so they can improve their skills getting innovation done.

@ElemarJR
ElemarJR / index.cs
Last active August 2, 2017 12:51
Esent: out of memory
public sealed class Debts_ByPayer : AbstractMultiMapIndexCreationTask<PayerInfoForBilling>
{
public Debts_ByPayer()
{
AddMap<Debt>(debts =>
from debt in debts
let person = LoadDocument<Person>("people/" + debt.Charging.PersonId.ToString())
let agreement = LoadDocument<Agreement>(debt.Source.ToString())
let personIds = person.Id.ToString().Split('/')
let agreementIds = agreement.Id.ToString().Split('/')
using System;
using System.Linq;
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Indexes;
namespace ConsoleApp1
{
class Program
{