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: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
@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 / 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");
}
# 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 / 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,
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 / 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
{
/*