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
//http://www.niedermann.dk/2009/06/18/BestPracticeDisposePatternC.aspx | |
public class BestPracticeDisposePattern : IDisposable | |
{ | |
private bool m_IsDisposed; | |
~BestPracticeDisposePattern() | |
{ | |
Dispose(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
// From: http://stackoverflow.com/a/3806407/959245 | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Dynamic; | |
using System.Linq; | |
using System.Text; | |
using System.Web.Script.Serialization; |
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 (ko, handlers, unwrap, extend) { | |
"use strict"; | |
extend(handlers, { | |
href: { | |
update: function (element, valueAccessor) { | |
handlers.attr.update(element, function () { | |
return { href: 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
using System; | |
using System.IO; | |
using System.Web; | |
/// <summary> | |
/// Removes CSS from rendered HTML page. | |
/// </summary> | |
public class InlineCssModule : IHttpModule | |
{ |
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
{ | |
"results":[ | |
{ | |
"text":"Country", | |
"children":[ | |
{ | |
"id":11082, | |
"text":"SRI LANKA (LK)" | |
}, | |
{ |
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
// Usage: | |
// <span data-bind="text: FromDate, data: { 'item' : ItemID}"></span> => 'data-item' has ItemID() value | |
// <span data-bind="text: FromDate, data: { 'value' : $data}"></span> => 'data-value' will be rendered as JSON | |
// <span data-bind="text: FromDate, data: { 'item' : ItemID, value' : $data}"></span> => more than one data attribute | |
// | |
// or something confusing as | |
// <span data-bind="text: FromDate, data: ItemID, name: 'item'"></span> | |
ko.bindingHandlers.data = { |
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.money = { | |
update: function (element, valueAccessor, allBindingsAccessor, viewModel) { | |
var value = valueAccessor(); | |
var allBindings = allBindingsAccessor(); | |
var valueUnwrapped = ko.utils.unwrapObservable(value) || 0; | |
var output = output = accounting.formatMoney(valueUnwrapped, OKLO.CurrencySign); | |
if ($(element).is("input") === true) { |
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 SessionObject | |
{ | |
public string user { get; set; } | |
public string account { get; set; } | |
public string session_id { get; set; } | |
} | |
public class BingMailConfigOptions | |
{ | |
public string AuthUserName { get; set; } |
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 class Extensions{ | |
public static TInner IfNotNull<T, TInner>(this T source, Func<T, TInner> selector, bool createNew = false) | |
where T : class | |
{ | |
return source != null | |
? selector(source) : (createNew ? Activator.CreateInstance<TInner>() : default(TInner)); | |
} | |
} |
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 shadeColor2(color, percent, hash) { | |
var f=parseInt((hash? color.slice(1) : color),16), | |
t=percent<0?0:255, | |
p=percent<0?percent*-1:percent, | |
R=f>>16, | |
G=f>>8&0x00FF, | |
B=f&0x0000FF; | |
return (0x1000000 | |
+(Math.round((t-R)*p)+R)*0x10000 |
OlderNewer