Skip to content

Instantly share code, notes, and snippets.

View rarous's full-sized avatar
💭
I may be slow to respond.

Aleš Roubíček rarous

💭
I may be slow to respond.
View GitHub Profile
@rarous
rarous / gist:593822
Created September 23, 2010 15:40 — forked from steida/gist:593816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Matters.Helpers;
using HtmlAgilityPack;
namespace Matters.Helpers
{
/*
public const string CharUnicodeFormat = "&#{0};";
public static string EncodeUnicodeChars(this string text) {
if (text == null) {
throw new ArgumentNullException("text");
}
return text.Aggregate(
new StringBuilder(),
@rarous
rarous / GeneratorExtensions.cs
Created May 25, 2011 11:43 — forked from renestein/gist:988359
BuildergenerovaniKolekceObjektu.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Builder_Algida_Row_Generator
{
class GeneratorExtensions
{
public LinkedList<TReturn> ApplyFunctionsWithHistory<TA1, TReturn>(TReturn arg1, TA1 arg2,
# Dependency injetion example.
class House
# We are asking for things in contructor.
constructor: (@kitchen) ->
# Service locator antipattern example.
class House
constructor: ->
# our class is looking for kitchen
@kitchen = new Kitchen
@rarous
rarous / Foreach.cs
Created April 16, 2012 07:46 — forked from renestein/Foreach.cs
ForEach extension with micro optimization
public static void ForEach<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
if (onNext == null)
{
throw new ArgumentNullException("onNext");
}
@rarous
rarous / linq.cs
Created September 6, 2012 16:17 — forked from vhenzl/gist:3657030
from x in list
where x
let y = new { X = x }
orderby y.X
select y;
@rarous
rarous / gist:3897226
Created October 16, 2012 04:25 — forked from kolman/gist:1427422
Game of Life rules
module CodeRetreat
open Xunit
type Cell =
| DeadCell of int
| LiveCell of int
let hasChanceToLife (cell:Cell) =
match cell with
$path = "~\AppData\Roaming\ncrunch2012\user.dat"
ri -Force $path
Dependency Injection a Inversion of Control
https://twitter.com/geekovo/status/290061513300000768
http://rarous.net/weblog/431-dip-ioc-a-di-dil-prvni.aspx
http://rarous.net/weblog/432-dip-ioc-a-di-dil-druhy.aspx
http://rarous.net/weblog/433-dip-ioc-a-di-dil-treti.aspx
public interface IStorage
{
Uri Save(Stream data, string name);
Task<Stream> LoadAsync(Uri dataUri);
}