Skip to content

Instantly share code, notes, and snippets.

View erichexter's full-sized avatar

Eric Hexter erichexter

View GitHub Profile
@erichexter
erichexter / gist:3717010
Created September 13, 2012 19:35
install chocolatey with windows auth proxy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted;$a=new-object net.webclient;$a.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials;$a.downloadstring('http://bit.ly/OKgXHP')|iex
@erichexter
erichexter / gist:3723562
Created September 14, 2012 17:59
web pi commands
view sourceprint?
1
@rem installer.cmd
2
SET WebPiCmd=.\webpicmd\WebPiCmd.exe
3
%WebPiCmd% /Install /Products:NETFramework4 /AcceptEula
4
%WebPiCmd% /Install /Products:SQLExpress /SQLPassword:P@ssw0rd /AcceptEula
@erichexter
erichexter / downloadBuildVideos.ps1
Created November 2, 2012 20:59
Download build 2012 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
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2012/RSS/wmvhigh"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-") + ".wmv"
if (!(test-path $file))
{
public class HomeViewModel
{
public IList<Device> Devices { get; set; }
public IList<Scene> Scenes { get; set; }
}
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);
@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">
[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))
{
@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
{
@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 / 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());