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); |
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
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
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
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
// 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
CREATE FUNCTION [dbo].[DelimStringToIntTable](@input AS VARCHAR(MAX)) | |
RETURNS | |
@Result TABLE(ID BIGINT) | |
AS | |
BEGIN | |
DECLARE @str VARCHAR(20) | |
DECLARE @ind Int | |
IF(@input is not null) | |
BEGIN |
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 interface IStringSerializer | |
{ | |
T Deserialize<T>(string item); | |
string Serialize(object item); | |
} |
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
<!-- | |
Import the Facebook API javascript. FB examples load this dynamically through jquery, but this avoids | |
any ajax caching issues. | |
--> | |
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> |
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 httpVerbs = { | |
POST: 'POST', | |
PUT: 'PUT', | |
PATCH: 'PATCH', | |
GET: 'GET', | |
DEL: 'DELETE' | |
}; | |
var constants = { | |
// Should be your application specific key for Azure |
OlderNewer