Skip to content

Instantly share code, notes, and snippets.

View DamianEdwards's full-sized avatar
🏠
Working from home

Damian Edwards DamianEdwards

🏠
Working from home
View GitHub Profile
@DamianEdwards
DamianEdwards / gist:3758904
Created September 20, 2012 23:14
SignalR + Knockout Chat
<form data-bind="submit: sendMessage">
<input type="text" data-bind="value: newMessage" />
<input type="submit" value="Send" />
</form>
<ul data-bind="foreach: messages">
<li data-bind="text: $data"></li>
</ul>
<script src="Scripts/jquery-1.8.1.js"></script>
@DamianEdwards
DamianEdwards / gist:4030394
Created November 7, 2012 09:31
Async site scraping in ASP.NET 4.5
public class SiteScrape : HttpTaskAsyncHandler
{
public override async Task ProcessRequestAsync(HttpContext context)
{
using (var http = new HttpClient())
{
var downloadTasks = new List<Task<string>> {
http.GetStringAsync("http://bing.com"),
http.GetStringAsync("http://google.com"),
http.GetStringAsync("http://oredev.org"),
@DamianEdwards
DamianEdwards / gist:4032153
Created November 7, 2012 15:09
Model binding to a dynamic object using an anon type as the "shape"
public partial class AdHocModelBindingAnonType : System.Web.UI.Page
{
protected dynamic Model { get; private set; }
protected void Page_Load()
{
Model = ModelBindingExecutionContext.Bind(new { FirstName = "" });
}
}
@DamianEdwards
DamianEdwards / gist:4032179
Created November 7, 2012 15:14
Some Model Binding helpers for ASP.NET Web Forms 4.5
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.ModelBinding;
namespace VS11BetaTAPWebForms
@DamianEdwards
DamianEdwards / ApplicationStartup.cs
Last active October 13, 2015 05:38
ASP.NET 5 ApplicationStartup base class
using System;
using Microsoft.AspNet.Builder;
using Microsoft.Dnx.Runtime;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNet.Hosting
{
/// <summary>
@DamianEdwards
DamianEdwards / Parts.md
Created November 14, 2015 22:03
Old desktop PC parts for sale

Some parts I no longer need after my recent dekstop rebuild. Make me an offer. Buyer pays for postage. Will sell individually or as a whole. All working to my best knowledge, but SOLD AS-IS.

  • GIGABYTE NVIDIA GeForce GTS 250 GV-N250ZL-1GI 1GB 256-Bit GDDR3 PCI Express 2.0 x16
  • GIGABYTE GA-EX58-UD4P Motherboard w/ Intel Core i7 920
    • Includes original Intel CPU fan & motherboard original accessories including SATA cables & SLI adapters
  • G.SKILL RIPJAWS DDR3-1600 PC3-12800 24GB 6x4GB CL9-9-9-24 1.5v
  • Thermolab Baram CPU cooler w/ fan clips for one side
@DamianEdwards
DamianEdwards / gist:4499713
Created January 10, 2013 05:37
SignalR chat using Knockout sync models idea
<form data-bind="submit: sendMessage">
<input type="text" data-bind="value: newMessage" />
<input type="submit" value="Send" />
</form>
<ul data-bind="foreach: messages">
<li data-bind="text: $data"></li>
</ul>
<script src="Scripts/jquery-1.8.3.js"></script>
@DamianEdwards
DamianEdwards / ChatHub.cs
Created January 10, 2013 06:10
SignalR peer-to-peer using class-less hubs idea
// This hub is optional, it's not required for the client to work.
// The client's call to "all.newMessage" will result in this Hub's
// NewMessage method being called so it can persist the message.
public class Chat : Hub
{
public void NewMessage(string message)
{
MyDataLayer.SaveMessage(message);
}
}
@DamianEdwards
DamianEdwards / gist:4958622
Created February 15, 2013 04:45
My Windows Phone 8 apps
4th & Mayor - FourSqaure client
Add to Calendar - support for ICS files attached to emails
Amazon Kindle
Amazon Mobile - can't live without this as a Seattelite
AppoinTile - more detailed upcoming appointments/meetings tile
Baconit - reddit client
Battery Level for WP8 - let's you see detailed battery status from lock screen, home screen, etc.
CrashPlan - so I can check my cloud backups
Dictionary.com - to settle arguments
Engadget - tech news
using System.Threading.Tasks;
using Microsoft.AspNet.Razor.TagHelpers;
namespace WebApplication1.TagHelpers
{
[HtmlTargetElement("raw")]
public class RawTagHelper : TagHelper
{
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{