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 JDictionary { | |
private List<JDictionary> items; | |
public string Key { get; set; } | |
public object Value { get; set; } | |
public JDictionary() { | |
items = new List<JDictionary>(); | |
} | |
public JDictionary this[int index] { |
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 namespace Graphing { | |
public class Graph<TX, TY> { | |
private readonly List<GraphData<TX, TY>> _data; | |
public Graph() { | |
_data = new List<GraphData<TX, TY>>(); | |
} | |
public GraphData<TX, TY> this[int index] { | |
get { return _data[index]; } |
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
//Thanks to BLUEPIXY for adding -number handling and overall a better implementation | |
[TestFixture] | |
public class IEnumerableRangeTest { | |
static public IEnumerable<int> GetRange(int start, int end){ | |
int step = (start > end)? -1:1; | |
for (int i = start; true ; i += step){ | |
yield return i; | |
if(i == end) break; | |
} | |
} |
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 AsyncUpload.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
public ActionResult Index() | |
{ | |
ViewBag.Message = "Welcome to ASP.NET MVC!"; | |
return View(); | |
} |
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
[Fact] | |
public void MessageAddedToRoomWithHashtagParsed() { | |
string expected = "<a href=\"#/rooms/hashtag\" title=\"#hashtag\">#hashtag</a>"; | |
string clientId = Guid.NewGuid().ToString(); | |
var repository = new InMemoryRepository(); | |
var room = new ChatRoom() { Name = "hashtag" }; | |
var user = new ChatUser() { Name = "testhashtaguser", Id = clientId }; | |
repository.Add(room); |
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 createProfile(profileContainer, profile) { | |
var expand = $("li.user div[data-val-gravatar='" + profile.hash + "']"); | |
var twitter = loadTwitter(profile); | |
var p = { | |
hash: profile.hash, | |
bio: { | |
name: profile.formatted, | |
about: profile.aboutMe, | |
hasTwitter: twitter != null |
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 HomeController : Controller | |
{ | |
// | |
// GET: /Home/ | |
private IEventStream stream; | |
public HomeController(IEventStream stream) | |
{ | |
this.stream = stream; | |
} |
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
<pre>@if(someBool){<text>output</text>}</pre> | |
<pre>@if(someBool){ | |
<text>output</text> | |
}</pre> | |
The above items create different output. | |
Specifically whitespace between { } is maintained when it shouldn't be on the second one. | |
The expected output for both statements should simply be "<pre>output</pre>". |
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
//write this to the once every 5 seconds for 5 iterations | |
Perform.This(() => { | |
Console.WriteLine(DateTime.UtcNow); | |
}) | |
.Every(TimeSpan.FromSeconds(5)) | |
.For(5) | |
.Start(); | |
//write to the console in 10 seconds | |
Perform.This(() => { |
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 Perform | |
{ | |
private readonly Action _action; | |
private int _delay; | |
private int _interval = Timeout.Infinite; | |
private int _iterations = int.MinValue; | |
private int _iterationsPerformed = 0; | |
private Timer _timer; | |
private int _until; |
OlderNewer