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
// add tablesorter parser to be able to sort on checkboxes | |
$.tablesorter.addParser({ | |
id: 'checkbox', | |
is: function (s, table, cell) { | |
return $(cell).find('input[type=checkbox]').length > 0; | |
}, | |
format: function (s, table, cell) { | |
return $(cell).find('input:checked').length > 0 ? 0 : 1; | |
}, | |
type: "numeric" |
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
// Resets the form's jQuery unobtrusive validation after elements where added dynamically to the form | |
(function ($) { | |
$.fn.resetUnobtrusiveValidation = function () { | |
// dynamically added element with unobtrusive validation attributes that was added to the form | |
var $this = $(this); | |
// remove unobtrusive validator from the elmement's form | |
var form = $this.closest("form") | |
.removeData("validator") | |
.removeData("unobtrusiveValidation"); | |
// parse the form again, validation is picked up for all elements (also dynamically added elements) |
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
XNamespace ns = "http://mycompany/myproduct/v2"; | |
foreach (XElement el in document.Root.DescendantsAndSelf()) | |
{ | |
el.Name = ns.GetName(el.Name.LocalName); | |
List<XAttribute> atList = el.Attributes().ToList(); | |
el.Attributes().Remove(); | |
foreach (XAttribute at in atList) | |
{ | |
el.Add(new XAttribute(ns.GetName(at.Name.LocalName), at.Value)); | |
} |
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 HtmlExtensions | |
{ | |
public static IHtmlString DropDownListFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, | |
Dictionary<string, IEnumerable<SelectListItem>> selectList) | |
{ | |
/* | |
* <select name="tmodel"> | |
* <optgroup label="Items"> | |
* <option value="item">Item</option> | |
* </select> |
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
To see which folders will be deleted: | |
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d" | |
And then to actually delete them, just run this: | |
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rd /q /s "%d" |
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
declare module 'path/to/the/module/file.ts' { | |
interface ClassNameInModule { | |
id: number; | |
} | |
} |
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 Startup | |
{ | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
// ... | |
services.AddControllers().AddJsonOptions(options => | |
{ | |
options.JsonSerializerOptions.PropertyNamingPolicy = new SnakeCasePropertyNamingPolicy(); | |
}); | |