View OwinRequestExtensions.cs
/// <summary>
/// Owin Request extensions.
/// </summary>
public static class OwinRequestExtensions
{
/// <summary>
/// Gets the combined request parameters from the form body, query string, and request headers.
/// </summary>
/// <param name="request">Owin request.</param>
/// <returns>Dictionary of combined form body, query string, and request headers.</returns>
View BooleanJsonConverter.cs
using System;
using Newtonsoft.Json;
namespace JsonConverters
{
/// <summary>
/// Handles converting JSON string values into a C# boolean data type.
/// </summary>
public class BooleanJsonConverter : JsonConverter
{
View CodeMirror_CurlyBraceWrappedText_Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CurlyBraceWrappedText Demo</title>
<style type="text/css">
.CodeMirror {border: 1px solid black;}
.cm-CurlyBraceWrappedText {color: #CC0000; font-weight: bold;}
</style>
<link rel="stylesheet" href="css/codemirror.css">
View ConnectionStringHelper.cs
using System;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Utilities
{
/// <summary>
View RegisterWindowsScheduledTasks.ps1
##########################################
### Registers Windows Scheduled Tasks ###
##########################################
<###############################################################################################################
Notes:
- This example was from a working solution I created where this script was run as a post-deploy step for a
console application that served as the entry point for multiple scheduled tasks that could be executed
by supplying the task name.
View OracleOptionalDateRangeQuery.sql
/* Oracle PL/SQL example of a query with an optional date range */
SET SERVEROUTPUT ON;
DECLARE
StartDate DATE := NULL;
EndDate DATE := NULL;
--StartDate DATE := TO_DATE ('01/01/2017', 'mm/dd/yyyy');
--EndDate DATE := TO_DATE ('02/01/2017', 'mm/dd/yyyy');
RecordCount NUMBER;
BEGIN
SELECT COUNT(*)
View ValidateOrderByClause.cs
internal void ValidateOrderByClause(string orderBy, string[] supportedOrderByFields)
{
if (!string.IsNullOrWhiteSpace(orderBy))
{
var orderBys = orderBy.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
foreach (var orderByClause in orderBys)
{
var orderByClauseParts = orderByClause.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
var orderByClauseField = orderByClauseParts[0];
View ConfigurationManagerOptionsProvider.cs
using System;
using System.Configuration;
using System.Reflection;
namespace Utilities.Options
{
/// <summary>
/// Uses <see cref="ConfigurationManager"/> to populate options.
/// Finds setting names/keys by <see cref="OptionNameAttribute"/>, {PropertyName}, or {ClassName}.{PropertyName}.
/// </summary>
View Add_Yourself_As_A_Sql_Server_Express_SysAdmin.txt
Adding Yourself as SQL Server Express SysAdmin
----------------------------------------------
Problem:
The help desk installs SQL Server on our developer machines under their own user accounts meaning you aren't a
sysadmin on your own SQL Server Express instance which in turn means you can't create a new database.
Solution:
View ConsoleColorExtensions.cs
using System;
namespace Utilities.Extensions
{
public static class ConsoleColorExtensions
{
/// <summary>
/// Writes the specified string value, followed by the current line terminator, to the standard output stream.
/// </summary>
/// <example>