Skip to content

Instantly share code, notes, and snippets.

View miroslavpopovic's full-sized avatar

Miroslav Popovic miroslavpopovic

View GitHub Profile
@miroslavpopovic
miroslavpopovic / ThreadingHelpers.cs
Created July 27, 2020 21:12
Dotnetos Async Expert: Module 02 homework
using System;
using System.Threading;
namespace ThreadPoolExercises.Core
{
public class ThreadingHelpers
{
public static void ExecuteOnThread(Action action, int repeats, CancellationToken token = default, Action<Exception>? errorAction = null)
{
// * Create a thread and execute there `action` given number of `repeats` - waiting for the execution!
@miroslavpopovic
miroslavpopovic / Program.cs
Created December 1, 2015 14:29
Inject dictionary of interfaces with Ninject
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
namespace ConsoleApplication5
{
public class Program
{
public static void Main(string[] args)
@miroslavpopovic
miroslavpopovic / consoleDiff.js
Last active December 14, 2015 08:58
A function that's using https://github.com/kpdecker/jsdiff to display a difference between two strings in a console. Tested on latest versions of Firebug and Chrome Developer Tools. Developer tools in IE 10 and below don't support CSS styles in console.
(function() {
// A function that's using https://github.com/kpdecker/jsdiff to display a
// difference between two strings in a console.
// Tested on latest versions of Firebug and Chrome Developer Tools.
// Developer tools in IE 10 and below don't support CSS styles in console.
var consoleDiff = function (first, second, diffType) {
var normalStyle = 'color: black; background-color: white; text-decoration: none;',
addStyle = 'color: #406619; background-color: #eaf2c2; text-decoration: none;',
removeStyle = 'color: #b30000; background-color: #fadad7; text-decoration: line-through;',
text = '',