Skip to content

Instantly share code, notes, and snippets.

View rionmonster's full-sized avatar

Rion Williams rionmonster

View GitHub Profile
@rionmonster
rionmonster / gist:1072469d6b50e447d022
Created March 24, 2015 22:12
Continued Attempt at Dynamic Glyphs
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.CSS.Editor.Completion;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Drawing;
using System.Drawing.Text;
@rionmonster
rionmonster / Example.cshtml
Last active December 23, 2015 15:21
Example of ViewBag Usage
<select asp-for="Group" asp-items="ViewBag.Options">
<option>Please select an Option</option>
</select>
<select asp-for="Organization" asp-items="ViewBag.Organizations" class="form-control custom-select">
<option>Please select an Organization</option>
</select>
@rionmonster
rionmonster / 503.2 Error
Created January 5, 2016 16:59
RedirectToAction throwing 503.2 "Bad Gateway Error"
[HttpPost]
[Route("Account/LogIn")]
public async Task<IActionResult> LogIn(SignInViewModel model, string returnUrl = null)
{
// If you put the redirect here, it works fine...
ViewData["ReturnUrl"] = returnUrl;
if (ModelState.IsValid)
{
// This doesn't count login failures towards account lockout
[Export(typeof(IVsTextViewCreationListener))]
[ContentType("aspx")]
[TextViewRole(PredefinedTextViewRoles.Document)]
class AspxTextViewListener : IVsTextViewCreationListener
{
// This will be triggered when an HTML document is opened
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
// If the Glyphs haven't been loaded, load them
if(GlyphfriendPackage.Glyphs == null)
public COMP UpdateComp(COMP newObj, int idOriginal)
{
var original = _context.Comps.FirstOrDefault(m => m.ID == idOriginal);
// Update these properties using your new information
original.CHECKLISTs = newObj.CHECKLISTs;
original.Division = newObj.Division;
_context.SaveChanges();
// When you return the original it should have those changes made
return original;
}
public class HomeController : Controller
{
[HttpGet]
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(HttpPostedFileBase file)
static void Main(string[] args)
{
// Create a stopwatch for performance testing
var stopwatch = new Stopwatch();
// Test content
var data = GetTestingBytes();
// Looping Test
using (var s1 = new MemoryStream())
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace ExampleConsole
{
class Program
{
public class Complaint
{
public int Id { get; set; }
public string Reason { get; set; }
public ComplaintFiler ComplaintFiler { get; set; }
}