Skip to content

Instantly share code, notes, and snippets.

View pytlus93's full-sized avatar

Filip Vrba pytlus93

  • Czech Republic
View GitHub Profile
System.Attribute.GetCustomAttributes(x, typeof(IgnoreAttribute), true)
@pytlus93
pytlus93 / broken_indexes.cshtml
Last active September 7, 2017 11:29
MVC5 Post List with broken indexes (https://stackoverflow.com/a/8598287/5502597)
<input type="hidden" name="Items.Index" value="0" />
<input type="text" name="Items[0].Name" value="someValue1" />
<input type="hidden" name="Items.Index" value="1" />
<input type="text" name="Items[1].Name" value="someValue2" />
<input type="hidden" name="Items.Index" value="3" />
<input type="text" name="Items[3].Name" value="someValue3" />
@pytlus93
pytlus93 / GetDivWidthFromCss.js
Created July 14, 2017 11:18
Get value of css width for class
function width(that)
{
var $class = $(that).hasClass('col-md-12') ? 'col-md-9' : 'col-md-12';
var element = $('<div/>').addClass($class).appendTo('body').wrap('<div style="display: none"></div>');
var width = element.css('width');
element.remove();
return width;
}
SELECT
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows AS RowCounts,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS TotalSpaceMB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS UsedSpaceMB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB,
CAST(ROUND(((SUM(a.total_pages) - SUM(a.used_pages)) * 8) / 1024.00, 2) AS NUMERIC(36, 2)) AS UnusedSpaceMB