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
ko.bindingHandlers.keyFilter = { | |
init: function(element, value, allBindings) { | |
var filter = ko.bindingHandlers.keyFilter[allBindings.keyFilter]; | |
if (!filter) return; | |
$(element).keypress(function(event) { | |
if (!filter(event.which)) { | |
event.stopPropagation(); | |
return false; |
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
jQuery.parseJSON = (function(parse) { | |
var datePattern = /^\/Date\((\d+)\)\/$/; | |
return function(data) { | |
var value = parse(data); | |
parseDates(value); | |
return value; | |
} | |
function parseDates(obj) { | |
for (var k in obj) { |
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
// This won't work as you probably want | |
for (var i = 0; i < 10; i++) { | |
handlers.push(function() { | |
use(i); | |
}); | |
} | |
// This won't work due to "var yanking" | |
for (var i = 0; i < 10; i++) { | |
var j = i; |
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
class CustomerController : Controller { | |
public ActionResult List() { | |
var customers = DB.GetAllCustomers(); | |
ViewModel.Customers = customers; | |
ExtendViewModel<Customer>("Url", customer => Url.Action("details", new { customer.Id })); | |
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
static void StaticKeyBug() | |
{ | |
using (var store = new DocumentStore()) | |
{ | |
store.Url = "http://localhost:8080"; | |
store.Initialize(); | |
store.DatabaseCommands.PutAttachment("test/hello/world", null, new byte[] { 1, 2, 3 }, new JObject()); | |
using (var wc = new WebClient()) |
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
Given loadPage('/login'), [ | |
Given userIsRemembered('johnsmith'), [ | |
When [ | |
'enter correct password': input(password: 'test') | |
click 'login' | |
] | |
Then [ | |
dashboardScreenLoaded() | |
] | |
] |
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
// Sorry to stir things up, but I really don't get on with the current *Unit test frameworks | |
// in C#. I hate creating_long_semi_english method names. I hate then repeating myself | |
// in code e.g. public void It_sould_equal_10() { Assert.That(it == 10); } | |
// I think the problem stems from making a method the atom of a test. | |
// This leads to crap method names and hard to understand tests. | |
// What follows is a different approach. (Not real code yet, just ideas!) | |
// One Test class per class under test. | |
// Inherits framework `Tests` class to provide test-DSL methods. |
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 Global : System.Web.HttpApplication { | |
protected void Application_Start(object sender, EventArgs e) { | |
var store = new SmartMessageStore(); | |
DependencyResolver.Register(typeof(IMessageStore), () => store); | |
} | |
} |
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
> SemVerCompare.exe old\Cassette.dll new\Cassette.dll | |
Type added: Cassette.CassetteApplicationContainer | |
Type added: Cassette.ICassetteApplicationContainer`1 | |
Type changed: Cassette.IO.IsolatedStorageDirectory | |
Member added: Void .ctor(System.Func`1[System.IO.IsolatedStorage.IsolatedStorageFile]) | |
Type changed: Cassette.ICassetteApplication | |
Member added: System.Collections.Generic.IEnumerable`1[Cassette.Bundle] get_Bundles() | |
Member added: System.Collections.Generic.IEnumerable`1[Cassette.Bundle] Bundles | |
Type changed: Cassette.IO.IsolatedStorageFile |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Resource</title> | |
</head> | |
<body> | |
@TestHelper() | |
</body> | |
</html> |
OlderNewer