Skip to content

Instantly share code, notes, and snippets.

View erichexter's full-sized avatar
😮

Eric Hexter erichexter

😮
View GitHub Profile
@erichexter
erichexter / download.ps1
Last active December 18, 2015 02:18
Download the Microsoft Build 2013 videos - Just the Developer Videos
[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{
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
cinst hexter.octopus
"c:\Program Files (x86)\Octopus\Tools\Tools.exe"
#install-package Microsoft.Web.Xdt -Prerelease
var doc = new XmlTransformableDocument();
doc.Load(@"..\..\..\www\web.config");
var t = new XmlTransformation(@"..\..\..\www\web.ci.config");
if (t.Apply(doc))
{
doc.Save("foobar.xml");
@erichexter
erichexter / ToJsonExtension.cs
Created November 29, 2012 03:17
Loading KnockoutJS viewmodels from a server side razor template.
using System.IO;
using Newtonsoft.Json;
namespace UI.Models
{
public static class ObjectExtensions
{
public static string ToJson(this object obj)
{
JsonSerializer js = JsonSerializer.Create(new JsonSerializerSettings());
@erichexter
erichexter / gist:4141226
Created November 24, 2012 20:08
Example of registering child menus.
var routes = new System.Web.Routing.RouteCollection();
routes.MapNavigationRoute<HomeController>("Home", c => c.Index())
.AddChildRoute<HomeController>("Logout", c => c.Logout())
.AddChildRoute<HomeController>("Foobar", c => c.ChangePassword());
@erichexter
erichexter / RouteConfig.cs
Created November 22, 2012 01:50
Example of using NavigationRoutes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
// You need to add this using statement to use the MapNavigationRoute extension method.
using NavigationRoutes;
namespace MvcApplication13
{
[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
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/WindowsAzureConf/2012/RSS/mp4high"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-") + ".mp4"
if (!(test-path $file))
{
@using UI.Controllers
@using UI.Models
@model UI.Controllers.HomeViewModel
@{
ViewBag.Title = "Lighting";
}
<h2>Hexter's</h2>
<div id="heartbeat" data-bind="text: Heartbeat"></div>
<div class="ui-grid-a">
<div class="ui-block-a">
public class HomeController : Controller
{
DeviceRepository _repository = new DeviceRepository();
SceneRepository _sceneRepository = new SceneRepository();
public Actio01nResult Index()
{
HomeViewModel model = new HomeViewModel();
model.Devices = _repository.GetAll();
model.Scenes = _sceneRepository.GetAll();
return View(model);
public class HomeViewModel
{
public IList<Device> Devices { get; set; }
public IList<Scene> Scenes { get; set; }
}