Skip to content

Instantly share code, notes, and snippets.

View yallie's full-sized avatar

Alexey Yakovlev yallie

View GitHub Profile
@yallie
yallie / Hello.cs
Created November 24, 2012 18:17
Zyan «Hello, World» example
/* Server */
// Create component host named "ZyanDemo" and bind to TCP port 8080
var host = new ZyanComponentHost("ZyanDemo", 8080);
// Register component type and interface
host.RegisterComponent<IHelloWorldService, HelloWordService>();
/* Client */
@yallie
yallie / HelloZyanServer.cs
Last active October 13, 2015 04:38
Zyan «Hello, World» server
// Create component host named "ZyanDemo" and bind to TCP port 8080
var host = new ZyanComponentHost("ZyanDemo", 8080);
// Register component type and interface
host.RegisterComponent<IHelloWorldService, HelloWorldService>();
@yallie
yallie / HelloZyanClient.cs
Last active October 13, 2015 04:38
Zyan «Hello, World» client
// Connect to server
var connection = new ZyanConnection("tcp://localhost:8080/ZyanDemo");
// Create HelloWorldService proxy
var proxy = connection.CreateProxy<IHelloWorldService>();
// Invoke method
proxy.SayHello("HelloWorld");
// Subscribe to a remote event
@yallie
yallie / test.cs
Last active March 11, 2021 02:07
IndexOfAny for strings
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
struct Program
{
static void Main()
{
@yallie
yallie / hashset.cs
Created February 22, 2013 06:35
HashSet<char>.Contains(c) versus string.Contains(c)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
struct Program
{
static void Main()
{
@yallie
yallie / hashset2.cs
Last active December 14, 2015 02:09
HashSet<char> benchmark, version #2
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
struct Program
{
static void Main()
{
@yallie
yallie / hashset3.cs
Created February 22, 2013 09:48
HashSet<char> benchmark, version #3.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
struct Program
{
static void Main()
{
@yallie
yallie / hashset4.cs
Created February 22, 2013 10:13
string vs HashSet<char>, version #4.
using System;
using System.Collections.Generic;
using System.Diagnostics;
struct Program
{
static void Main()
{
const int iterations = 100000;
@yallie
yallie / chardict.cs
Last active December 14, 2015 02:49
CharDictionary<T> to replace Dictionary<char, T>. About 4 times faster than the original.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
struct Program
{
static void Main()
{
// source data
@yallie
yallie / chardict2.cs
Last active December 14, 2015 03:39
Faster replacement classes for Dictionary<char, T>.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
struct Program
{
static void Main()
{
// source data