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
// Problematic short example | |
var q = db.X.All().Join(db.Y, XId: db.X.Id).WithY(); | |
// Problematic real example | |
var q = db.List.All().Join(db.Question, ListId: db.List.Id).WithQuestion(); | |
// Suggested short example | |
var q = db.X.All().Join(db.Y, XId: db.X.Id ).With(db.X.Y); |
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
public int LastIndexOf(string value) | |
{ | |
return this.LastIndexOf(value, this.Length - 1, this.Length, string.LegacyMode ? StringComparison.Ordinal : StringComparison.CurrentCulture); | |
} | |
// What is LegacyMode ? | |
internal static bool LegacyMode | |
{ | |
get |
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
using( var reader = new CsvReader(new StringReader(data))) | |
{ | |
while (reader.Read()) | |
{ | |
var rec = reader.CurrentRecord; | |
} | |
} |
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
public static HtmlString ParseTemplates(string html) | |
{ | |
if (string.IsNullOrWhiteSpace(html)) return new HtmlString(html); | |
var doc = new HtmlDocument(); | |
doc.LoadHtml(html); | |
var root = doc.DocumentNode; | |
if (root != null) | |
{ |
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
function dialogHandler(id) { | |
var iesucks = new Date().getTime(); | |
$.ajax('/-/NodeService/GetTinyMceMediaStringFromId', { | |
type: "GET", | |
dataType: "json", | |
async: false, | |
data: { | |
id: id, | |
iesucks: iesucks | |
}, |
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
public static class StaticRegexes | |
{ | |
... | |
public static readonly Regex LocalMediaRegex = new Regex(@"/{localMedia:(\d+?)}", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); | |
} | |
public class NodeServiceController : Controller | |
{ | |
[HttpGet] | |
public JsonResult GetTinyMceMediaStringFromId(string id) |
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
public static HelperResult EditField<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression) | |
{ | |
var path = "/Templates/Partials/EditField/" + (template ?? "Default") + ".cshtml"; | |
var page = WebPageBase.CreateInstanceFromVirtualPath(path); | |
var context = new WebPageContext(new HttpContextWrapper(HttpContext.Current), page, null); | |
var modelMetaData = ModelMetadata.FromLambdaExpression(expression, html.ViewData); | |
var fieldname = ExpressionHelper.GetExpressionText(expression); | |
context.PageData["Validation"] = html.GetUnobtrusiveValidationAttributes(fieldname, modelMetaData); |
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
public static void TestMapper<TSource>(TSource model, Expression<Func<TSource, object>> expression) | |
{ | |
var body = (NewExpression) expression.Body; | |
foreach (var argument in body.Arguments) | |
{ | |
var lambda = Expression.Lambda<Func<TSource, object>>(argument, expression.Parameters[0]); | |
var modelMetadata = ModelMetadata.FromLambdaExpression(lambda, new ViewDataDictionary<TSource>(model)); | |
} | |
} |
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
var fman = DI.Resolve<ShardManager>().Facets; | |
var years = fman.GetGroupFacets("Dates").Where(x => x.Key.FieldName == "Year").ToList(); | |
var newsTypes = PickerUtil.DecodeValue(node.GetPropertyString("newsTypes")); | |
var currentYear = Request["year"] ?? "year:"; | |
var currentNewsType = Request["newsType"] ?? "tags:"; | |
var facets = new List<Eksponent.Lucene.Facets.Facet>() | |
{ |
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
public class SecurityModule : IHttpModule | |
{ | |
private const string Key = "PageAccessAllowed"; | |
public void Dispose() | |
{ | |
} | |
public void Init(HttpApplication context) | |
{ |