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
// Custom binding for modal dialog | |
// Bind a Bootstrap modal div to an observable | |
// boolean. When the observable changes, the | |
// modal window's visibility will also change. | |
// | |
// The binding is two-way, so changes to the | |
// modal window's visibility will also change | |
// the bound observable's value | |
ko.bindingHandlers.bootstrapShowModal = { | |
init: function (element, valueAccessor) { |
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 GenericRepository<T> : IRepository<T> where T : class | |
{ | |
protected DbSet<T> DBSet {get;set;} | |
protected DbContext Context { get; set; } | |
public GenericRepository(DbContext context) | |
{ | |
if (context == null) | |
{ | |
throw new ArgumentException("An instance of DbContext is " + |
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 ValidationUtility = function() { | |
var validationElements = $('[data-role="validate"]'); | |
var elementCount; | |
validationElements.popover({ | |
placement: 'top' | |
}); | |
validationElements.on('invalid', function() { | |
if (elementCount === 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 Newtonsoft.Json.Serialization; | |
using System.Web.Http; | |
using System.Web.Http.Validation.Providers; | |
using MyApplication.Web.Filters; | |
namespace MyApplication.Web | |
{ | |
public static class CustomGlobalConfig | |
{ | |
public static void Customize(HttpConfiguration config) |
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.multiselect = { | |
init: function (element, valueAccessor, allBindingAccessors) { | |
"use strict"; | |
var options = valueAccessor(); | |
ko.bindingHandlers.options.update( | |
element, | |
function() { return options.options; }, | |
allBindingAccessors |
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 double DiceCoefficient(string stOne, string stTwo) | |
{ | |
HashSet<string> nx = BuildBigramSet(stOne); | |
HashSet<string> ny = BuildBigramSet(stTwo); | |
HashSet<string> intersection = new HashSet<string>(nx); | |
intersection.IntersectWith(ny); | |
double dbOne = intersection.Count; | |
return (2 * dbOne) / (nx.Count + ny.Count); |
NewerOlder