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
#Needs to be ran as administrator | |
#Logs in as user and creates a generic listing | |
##hacker-line that causes this script to run in a new session as administrator if not already elevated | |
#if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
#{ | |
# Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; | |
# exit | |
#} |
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
#Needs to be ran as administrator | |
#Performs a login and logout using a valid account | |
#Hardcoded local host means you need to have a Visual Studio running an instance of the app, or change the url | |
#hacker-line that causes this script to run in a new session as administrator if not already elevated | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
{ | |
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; | |
exit |
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
/// <summary>Converts a SqlCommand object to the equivelant TSQL Query. This can be useful for examining the parameters or debugging generated statements using SSMS.</summary> | |
/// <remarks>From https://stackoverflow.com/a/4146573/1363780 with style modifications and misc fixes</remarks> | |
public static class SqlCommandToQueryString | |
{ | |
/// <summary> Converts the SqlCommand to the equivelant TSQL query string</summary> | |
/// <param name="cmd">The SqlCommand object to convert</param> | |
/// <returns>A string representation of the SqlCommand. This will be valid TSQL and can be copy/pasted into SSMS and executed or debugged.</returns> | |
public static string Convert(SqlCommand cmd) | |
{ | |
StringBuilder sqlString = new StringBuilder(); |
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
--Get tables and their current identity | |
--This is useful to double check ID values when a database has been seeded with initial data and we want to jump the id's up by a few thousand for appearance sake | |
--For when we dont want people to see ID = 1, Id = 2, Id =3 | |
SELECT | |
[schema] = s.name, | |
[table] = t.name, |
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 System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
namespace WebsiteComments.Models | |
{ | |
public class Comment |
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 System.Collections.Generic; | |
namespace wsbcollector.Article | |
{ | |
public class MediaEmbed | |
{ | |
public string content { get; set; } | |
public int? width { get; set; } | |
public bool? scrolling { get; set; } | |
public int? height { get; set; } |
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 SPRI.WebsiteUtilities | |
@model DateTime | |
@* | |
Note: only meant to serve timezone conversions in the USA and maybe NA and SA. | |
Gives you a label with the date formatted to ISO 8601 format, javascript will understand this and be able to convert for display. | |
Adds a class that js looks for when converting stuff. | |
*@ | |
@if (Model.Kind != DateTimeKind.Utc && Model.Kind != DateTimeKind.Unspecified) | |
{ | |
Debug.WriteLine("DateTime attempted to be localized that was not in UTC format. Display errors will occurr. " + Model.Kind + " " + Model.ToString("O")); |
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
/* | |
This will generate a result set where each row is a SQL Statement that will generate an | |
index for a specific foreign key. The script first checks for the existance of the index | |
it is about to create and if it exists, the index is dropped. The generated script then | |
creates the index. The indexes are searched for and created using my own naming guidelines | |
and an example is given of what the script might generate for an index on TableName and FK | |
ColumnName. | |
--TableName.ColumnName | |
--Delete index if it exsits |
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 System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using Microsoft.Build.Evaluation; | |
using Microsoft.Build.Construction; | |
namespace SourceCombiner |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Threading.Tasks; | |
/* | |
Ideas from | |
http://stackoverflow.com/a/2416762/1363780 |
NewerOlder