Skip to content

Instantly share code, notes, and snippets.

Tieson Trowbridge tiesont

Block or report user

Report or block tiesont

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tiesont
tiesont / DbContextExtensions.cs
Last active Mar 12, 2017
Partial class, with overrrides for the various overloads of DbContext.SaveChanges, for getting the inner exceptions from a "DbEntityValidationException" event. Change "DataModel" to the name you gave your data model.
View DbContextExtensions.cs
public partial class DataModel
{
public override int SaveChanges()
{
try
{
return base.SaveChanges();
}
catch (DbEntityValidationException ex)
{
@tiesont
tiesont / nav-wizard.bootstrap.css
Last active Feb 20, 2018 — forked from bjcull/nav-wizard.bootstrap.css
Wizard style navigation tabs for bootstrap, updated for Bootstrap 4. Demo: https://jsfiddle.net/dss1mjqf/
View nav-wizard.bootstrap.css
.nav-pills.nav-wizard > li
{
position: relative;
overflow: visible;
border-right: 15px solid transparent;
border-left: 15px solid transparent;
}
.nav-pills.nav-wizard > li + li
{
@tiesont
tiesont / so-greyish.css
Created Feb 8, 2017
Stack Overflow new navbar tweak - greyish
View so-greyish.css
@-moz-document domain("stackoverflow.com") {
/* Uncomment if removing sticky header */
/*body.newheader {
padding-top: 0;
}*/
.so-header {
background-color: #f3f3f3;
/* Uncomment to remove sticky header */
/*position: relative;*/
@tiesont
tiesont / RouteMapsSansHome.cs
Created Jan 10, 2017
Demonstrates how to remove "home" from routing without needing to explicitly map other controllers
View RouteMapsSansHome.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace MyNamespace
{
public class RouteConfig
@tiesont
tiesont / PasswordUtility.cs
Last active Jan 5, 2017
This is the Crypto class from System.Web, modified to remove globalization support (which is the only dependency Crypto has on System.Web). It also adds an optional parameter to the hash and verify methods to allow callers to increase the hash iteration count. Everything else is unchanged.
View PasswordUtility.cs
using System;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
public class PasswordUtility
{
// Original Version Copyright:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Original License: http://www.apache.org/licenses/LICENSE-2.0
View FileUploadEx.cs
using System;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Microsoft.Internal.Web.Utils;
using Microsoft.Web.Helpers.Resources;
namespace YourNamespaceHere
@tiesont
tiesont / OpenSslAes.vb
Created Jan 21, 2015
VisualBasic.NET implementation of Scott Lowe's OpenSslAes class.
View OpenSslAes.vb
Imports System.Collections.Generic
Imports System.IO
Imports System.Security.Cryptography
Imports System.Text
Namespace Security
''' <summary>
''' OpenSSL AES CBC 256 in .NET for interop with Ruby
''' </summary>
View config.json
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 46.7%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
@tiesont
tiesont / SecurityProvider.cs
Created May 10, 2014
Partial class for plugging into FluentSecurity
View SecurityProvider.cs
public partial class SecurityProvider
{
public static bool ActionIsAllowedForUser(string controllerName, string actionName)
{
var configuration = SecurityConfiguration.Get<MvcConfiguration>();
var policyContainer = configuration.Runtime.PolicyContainers.GetContainerFor(controllerName, actionName);
if (policyContainer != null)
{
var results = policyContainer.EnforcePolicies(configuration.CreateContext());
return results.All(x => x.ViolationOccured == false);
@tiesont
tiesont / gmailsender.cs
Last active Jan 2, 2016
Helper class used to access a Gmail account remotely for the purpose of sending an email message
View gmailsender.cs
/// <summary>
/// GmailSender: Class used to access a Gmail account remotely for the purpose of sending an email message
/// </summary>
public class GmailSender
{
/// <summary>
/// Static method. Accepts required elements for sending a email through the Google Mail system.
/// </summary>
/// <param name="to">The target (recipient) of the email message.</param>
/// <param name="subject">Subject line value for the email.</param>
You can’t perform that action at this time.