This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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; |
NewerOlder