Skip to content

Instantly share code, notes, and snippets.

View RobertBonham's full-sized avatar

Robert Bonham RobertBonham

  • Robert's Stuff
  • Southern Oregon
View GitHub Profile
@RobertBonham
RobertBonham / 0_reuse_code.js
Created October 29, 2015 16:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@RobertBonham
RobertBonham / test.md
Last active September 29, 2015 23:14
testing markdown

Emphasis Strong

A link.

Some test with [a link][1] and another [link][2]

@RobertBonham
RobertBonham / Modal.js
Created December 9, 2013 06:01
Bootstrap Modal Javascript
<div id="theModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
...buttons
</div>
public class Singleton
{
private static readonly Singleton instance = new Singleton();
// Empty static ctor forces laziness
static Singleton()
{}
private Singleton()
{
// STuff that must only happen once
@RobertBonham
RobertBonham / ADLookup.cs
Created October 17, 2013 01:14
Asp.Net MVC 4 Base Controller to expose AD User information
public class AdLookup
{
public static DomainContext GetUserDetails()
{
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain))
{
IPrincipal principal = HttpContext.Current.User;
WindowsIdentity identity = ((WindowsIdentity)principal.Identity);
UserPrincipal user = UserPrincipal.FindByIdentity(pc, identity.Name);
@RobertBonham
RobertBonham / EntityHelper.cs
Last active December 25, 2015 14:59
DeleteData<T>(DbContext context) : Helper to Delete all data from a Entity Set. Good for small amounts of data. ContextDumpTest(DbContext context) : Helper to Dump the current status of the context SetSeedToZero GetTableName
#region *** Usings Directives ***
using System;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Objects;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
#Set the username for windows auth proxy
#$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
#http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/rss/mp4high/?sort=sequential&direction=desc&term=&r=Developer+Tools+%26+Application+Lifecycle+Management&r=Windows+Azure+Application+Development&y=Breakout&Media=true#fbid=FDnmapgI5Hf
#http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/RSS/mp4high
#http://channel9.msdn.com/Events/Build/2013/RSS/mp4high#theSessions
#http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/rss/mp4high/?sort=sequential&direction=desc&term=&r=Developer+Tools+%26+Application+Lifecycle+Management&r=Windows+Azure+Application+Development&y=Breakout&Media=true#fbid=FDnmapgI5Hf
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2013/RSS/mp4high#theSessions"))
$a.rss.channel.item | foreach{