Skip to content

Instantly share code, notes, and snippets.

View rustyswayne's full-sized avatar

Rusty Swayne rustyswayne

  • Health Catalyst
  • Bellingham, WA
View GitHub Profile
@sniffdk
sniffdk / ContextHelpers.cs
Last active February 28, 2022 10:03
Fake an UmbracoContext for use when doing published scheduling or other scenarios where UmbracoContext is normally null.
public class ContextHelpers
{
public static UmbracoContext EnsureUmbracoContext() {
if (UmbracoContext.Current != null)
{
return UmbracoContext.Current;
}
var httpContext = new HttpContextWrapper(HttpContext.Current ?? new HttpContext(new SimpleWorkerRequest("temp.aspx", "", new StringWriter())));
@joeriks
joeriks / Default.cshtml
Created August 12, 2012 18:47
Small SignalR + Managedesent sample, tested in WebMatrix (using App_Data), demonstrating using SignalR for "common" client-server calls which are usually done with jquery ajax+url's
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My Site's Title</title>
<script src="/Scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.signalR-0.5.2.min.js" type="text/javascript"></script>
<script src="/SignalR/hubs" type="text/javascript"></script>