Skip to content

Instantly share code, notes, and snippets.

View anthonyvscode's full-sized avatar

anthonyvscode

View GitHub Profile
@anthonyvscode
anthonyvscode / all_email_provider_domains.txt
Created August 11, 2022 04:17 — forked from ammarshah/all_email_provider_domains.txt
A list of all email provider domains (free, paid, blacklist etc). Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
0-mail.com
007addict.com
020.co.uk
027168.com
0815.ru
0815.su
0clickemail.com
0sg.net
0wnd.net
0wnd.org
@anthonyvscode
anthonyvscode / ko.bindingHandlers.autosize.js
Last active November 18, 2015 05:07
KnockoutJS autosize.js (http://www.jacklmoore.com/autosize/) custom binding handler
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(["knockout", "autosize"], factory);
} else {
// Browser globals
factory(ko, autosize);
}
}(this, function (ko, autosize) {
ko.bindingHandlers.autosize = {
@anthonyvscode
anthonyvscode / ko.bindingHandlers.currency.js
Last active October 23, 2015 01:02
KnockoutJS accounting.js binding handler
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(["jquery", "knockout", "accounting"], factory);
} else {
// Browser globals
factory($, ko, accounting);
}
}(this, function ($, ko, accounting) {
ko.bindingHandlers.currency = {
@anthonyvscode
anthonyvscode / ExceptionEnricher.cs
Created June 19, 2015 05:22
Serilog - Enrich Exception Logs with Server Variables
public class ExceptionEnricher : ILogEventEnricher
{
/// <summary>
/// The server variables added to an exception log.
/// </summary>
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
if (logEvent == null)
throw new ArgumentNullException("logEvent");
@anthonyvscode
anthonyvscode / gist:b04f1b92d64e37ef4afe
Created January 23, 2015 05:19
Initialize Ladda Bootstrap
this.initLadda = function() {
var selector = "input[type=submit]";
$(selector)
.attr("data-style", "zoom-in")
.each(function () {
var element = $(this);
if (element.hasClass('btn-xs')) {
element.attr("data-size", "xs");
}
@anthonyvscode
anthonyvscode / FlashHelper.cs
Created January 12, 2015 00:14
FlashHelper.cs
using Newtonsoft.Json;
using System;
using System.Web;
using System.Web.Mvc;
public static class FlashHelper
{
public static ActionResult WithInfo(this ActionResult actionResult, ControllerBase controller, string title = "", string message = "")
{
AddMessageToTempData(controller, AlertType.Info, title, message);
@anthonyvscode
anthonyvscode / ReportResult.cs
Created January 31, 2014 00:48
Doddle Reports - Export type by parameter
public class ReportResult : DoddleReport.Web.ReportResult
{
private readonly Report report;
public ReportResult(Report report)
: base(report)
{
this.report = report;
}
@anthonyvscode
anthonyvscode / Boolean.cshtml
Created December 18, 2013 07:06
MVC EditorTemplate for Nullable Booleans
@model bool?
@if (ViewData.ModelMetadata.IsNullableValueType) {
var items = new[]
{
new SelectListItem { Value = "", Text = "N/A" },
new SelectListItem { Value = "true", Text = "Yes" },
new SelectListItem { Value = "false", Text = "No" }
};
@Html.DropDownList("", new SelectList(items, "Value", "Text", Model.HasValue ? (Model.Value ? "true" : "false") : ""))
@anthonyvscode
anthonyvscode / FlashHelpers.cs
Last active February 8, 2016 17:18
Append Bootstrap 3 Response messages to MVC ActionResults
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace Helpers
@anthonyvscode
anthonyvscode / UnitOfWork.cs
Last active December 31, 2015 14:08
DbEntityValidationException with useful message returned for logging to Elmah.
public void Save()
{
try
{
context.SaveChanges();
}
catch(DbEntityValidationException ex)
{
var errorMessages = (from eve in ex.EntityValidationErrors
let entity = eve.Entry.Entity.GetType().Name