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 System; | |
namespace Rating | |
{ | |
class Program | |
{ | |
/// <summary > | |
/// Ratings | |
/// (Lower bound of Wilson score confidence interval for a Bernoulli parameter) | |
/// </summary> |
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
/// <summary> | |
/// Extension method for the "Page" class | |
/// </summary> | |
public static class PageHelper | |
{ | |
/// <summary> | |
/// Find control in the page | |
/// </summary> | |
/// <typeparam name="T">return control type(eg. TextBox)</typeparam> | |
/// <param name="page">Actual Page</param> |
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 Common.Extension | |
{ | |
using System.Linq; | |
using System.Linq.Expressions; | |
public static class GenericEvaulatingOrderBy | |
{ | |
private static IOrderedQueryable<T> OrderingHelper<T>(IQueryable<T> source, string propertyName, bool descending, bool anotherLevel) | |
{ | |
var param = Expression.Parameter(typeof(T), "p"); |
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.fn.rVal = function () { | |
if (this[0]) { | |
var ele = $(this[0]); | |
if (ele.attr('placeholder') != '' && ele.val() == ele.attr('placeholder')) { | |
return ''; | |
} else { | |
return ele.val(); | |
} | |
} | |
return undefined; |
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
// define cache | |
var cache = {}; | |
// ... | |
// within the AJAX callback | |
cache[url] = data; | |
// ... | |
// within callback that would set forth a request | |
if(cache[url]) { |
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
/// <summary> | |
/// Get Sift3 distance from two words. | |
/// (eg: spell checking) | |
/// </summary> | |
/// <param name="source"> source string </param> | |
/// <param name="actual"> actual string </param> | |
/// <param name="maxOffset"> max offset </param> | |
/// <returns> The distance of the two words. </returns> | |
public static float GetSift3Distance(string source, string actual, int maxOffset) | |
{ |
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
/// <summary> | |
/// Computate Levenshtein distance, not a normal returns format. | |
/// It returns the percentage difference. | |
/// </summary> | |
/// <param name="expected"> expected word </param> | |
/// <param name="actual"> actual word </param> | |
/// <returns> Value between 0 - 100 | |
/// 0==perfect match 100==totaly different </returns> | |
public static byte GetLevenshteinDistance(string expected, string actual) | |
{ |
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
try | |
{ | |
RuntimeHelpers.EnsureSufficientExecutionStack(); | |
// call recursion | |
} | |
catch (InsufficientExecutionStackException) | |
{ | |
// catch recursion stackoverflow exception | |
} | |
catch |
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 interval(func, wait, times){ | |
var interv = function(w, t){ | |
return function(){ | |
if(typeof t === "undefined" || t-- > 0){ | |
setTimeout(interv, w); | |
try{ | |
func.call(null); | |
} | |
catch(e){ | |
t = 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
namespace BloomFilter | |
{ | |
using System; | |
using System.Collections; | |
/// <summary> | |
/// Bloom filter. | |
/// </summary> | |
/// <typeparam name="T">Item type </typeparam> | |
public class Filter<T> |
OlderNewer