This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DebuggerStepThrough] | |
public static void ForEach<T>(this IEnumerable<T> items, Action<T> processor) | |
{ | |
foreach (var item in items) | |
{ | |
processor(item); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace CRIneta.Web.Core.Domain | |
{ | |
public class Attendee | |
{ | |
protected readonly string email; | |
protected readonly Meeting meeting; | |
protected readonly int attendeeId; | |
protected Attendee() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Int32 GetChainLength(Int32 value) | |
{ | |
Func<Int32, Int32> a = n => n / 2; | |
Func<Int32, Int32> b = n => 3 * n + 1; | |
Int32 chainLength = 1; | |
Int32 x = value; | |
while(x > 1) | |
{ | |
x = (x > 1 && x % 2 == 0) ? a(x) : b(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createMenu(desk) { | |
var createMenuItem = function(text, className) { | |
return $("<div/>").html(text).addClass("clickable").addClass(className).hide(); | |
}; | |
desk.append(createMenuItem('Trouble', 'troubleFlag')); | |
desk.append(createMenuItem('Leader', 'leaderFlag')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One of the reasons I like JavaScript: | |
function toggleTrait(trait, iconName) { | |
// some ugly code :) | |
((hasTrait) ? addIcon : removeIcon)(iconBar, iconName); | |
} | |
function addIcon(iconBar, iconName) { | |
iconBar.append($("<img/>").attr("src", "img/" + iconName + ".png")); | |
} | |
function removeIcon(iconBar, iconName) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class IoC | |
{ | |
private static readonly Container container; | |
static IoC() | |
{ | |
container = new Container(x => | |
{ | |
x.ForConcreteType<OrderFilter>() | |
.Configure.WithCtorArg("connectionString") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module("Some Module Name", { | |
setup: function() { | |
$("body").children(":not('.qunit-element')").remove(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal struct Tag | |
{ | |
private readonly string name; | |
private const string DEFAULT_TAG_NAME = "UnCategorized"; | |
public Tag(string name) | |
{ | |
this.name = name; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
linq.js -- a simple LINQ implementation for javascript | |
Author: Nate Kohari <[email protected]> | |
Copyright (C) 2009 Enkari, Ltd. | |
Released under the Apache 2.0 license (http://www.opensource.org/licenses/apache2.0.php) | |
*/ | |
Array.prototype.all = function(func) { | |
var result = true; | |
this.iterate(function(item) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var txn = session.BeginTransaction()) | |
{ | |
try | |
{ | |
session.SaveOrUpdate(entity); | |
session.Flush(); // <-- is this even necessary? UPDATE... Not necessary, thanks! :) | |
txn.Commit(); | |
} | |
catch (HibernateException) | |
{ |
OlderNewer