Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace RStein.Async.Schedulers
{
public class ProxyScheduler : TaskScheduler, IProxyScheduler, IDisposable
{
private readonly ITaskScheduler m_realScheduler;
using System.Threading.Tasks;
namespace RStein.Async.Schedulers
{
public interface IProxyScheduler
{
bool DoTryExecuteTask(Task task);
TaskScheduler AsTplScheduler();
}
}
@renestein
renestein / AgentRX.cs
Last active December 16, 2015 13:38
P. riedl emwac
var ts = myAgentList.ToObservable().Concat(
Observable.FromEventPattern
<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>
(
handler => myAgentList.CollectionChanged += handler,
handler => myAgentList.CollectionChanged -= handler
)
.Where(e => e.EventArgs.Action == NotifyCollectionChangedAction.Add)
.SelectMany(c => c.EventArgs.NewItems.Cast<MyAgent>()))
@renestein
renestein / gist:5434943
Last active December 16, 2015 12:29
Avoid lock in console - .Net 4.,5
// https://twitter.com/jechtom/status/326325740503175169
using System;
using System.Threading;
internal class Program
{
private static void Main(string[] args)
{
Console.Error.WriteLine("Dummy error init");
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Globalization;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
namespace Mormegill_test
//https://twitter.com/mormegil_cz/status/321991296019484672
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mormegill_test
{
//https://twitter.com/mormegil_cz/status/321991296019484672
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mormegill_test
@renestein
renestein / rodina.dlg
Last active December 15, 2015 10:19 — forked from josefslerka/rodina.dlg
rodic(josef, tana).
rodic(josef, sona).
rodic(josef, petr).
rodic(michaela, tana).
rodic(michaela, sona).
rodic(eva, michaela).
rodic(pavel,michaela).
rodic(miluska,josef).
rodic(josefstarsi,josef).
rodic(pavel, jitka).
@renestein
renestein / Program.cs
Last active October 19, 2022 06:21 — forked from rarous/gist:4352819
Aleš Roubíček Task with retry logic.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TaskWithRetry
{
internal class Program
{
//Pavel Machek - high level overview
void WcfGpsPositionService::GetPositionData(const RilSimpleInfo& info, const wstring& networkCode, GSMPosition& position)
{
try
{
wstring toHashValue = m_appKey + info.CellId;
string tempResult = MD5Hash::CalculateMD5Hash(toHashValue);