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 class FixedCapacityMovingBuffer<T> | |
{ | |
private readonly int _capacity; | |
private readonly T[] _buffer; | |
private int _addCount; | |
public FixedCapacityMovingBuffer(int capacity) | |
{ | |
_capacity = capacity; |
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 System; | |
using System.IO; | |
namespace jmcd | |
{ | |
public static class StreamExtensions | |
{ | |
public static byte[] ReadToEnd(this Stream stream) | |
{ | |
var result = new byte[0]; |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace jmcd | |
{ | |
public class MoveOperation<T> | |
{ | |
private readonly Func<T, int> _positionOf; | |
private readonly Action<T, int> _reposition; |
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 System; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using Microsoft.Web.Administration; | |
namespace WtfApp | |
{ | |
internal class Program |
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
@model gts.Web.Models.AddressFields | |
<ul> | |
<li> | |
@Html.HumanLabelFor(x => x.Line1) | |
@Html.TextBoxFor(x => x.Line1) | |
@Html.ValidationMessageFor(x => x.Line1) | |
</li> | |
<li> | |
@Html.HumanLabelFor(x => x.Line2) |
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($) { | |
var methods = { | |
init: function() { | |
var $ul = $("<ul/>").insertAfter(this); | |
var baseId = "_" + $(this).attr("id"); | |
$(this).children("option").each(function(index) { | |
var $option = $(this); | |
var id = baseId + index; | |
var $li = $("<li/>").appendTo($ul); |
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
var scheduleDateAlias = default(ScheduleDate); | |
return session.QueryOver(() => scheduleDateAlias) | |
.WithSubquery.WhereNotExists( | |
QueryOver.Of<CommunityGrantApplicationChequeRequest>() | |
.Where(x => x.ScheduleDate.Id == scheduleDateAlias.Id) | |
.Select(x => x.ScheduleDate) | |
) | |
.OrderBy(scheduleDate => scheduleDate.Rank).Asc | |
.List<ScheduleDate>(); |
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 class ByteArrayBuilder | |
{ | |
private byte[] _buffer; | |
public int Length { get; set; } | |
public ByteArrayBuilder() | |
{ | |
_buffer = new byte[4096]; | |
Length = 0; | |
} |
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 class ComboMaskFactory | |
{ | |
private int _current; | |
private readonly int _lim; | |
public ComboMaskFactory(int maxNumberOfBitsInMask, int numberOfOneBits) | |
{ | |
if (maxNumberOfBitsInMask > 32) throw new Exception("ComboMaskFactory can only be used with maxNumberOfBitsInMask up to 32."); | |
_current = GetLowestValueUsingSuppliedNumberOfOneBits(numberOfOneBits); | |
_lim = 1 + _current << maxNumberOfBitsInMask - numberOfOneBits; |
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 IntExtensions | |
{ | |
public static string GetOrdinalSuffix(this int @this) | |
{ | |
switch (@this % 100) | |
{ | |
case 11: | |
case 12: | |
case 13: | |
return "th"; |
OlderNewer