Skip to content

Instantly share code, notes, and snippets.

@jwmcpeak
jwmcpeak / ExternalLinkTagHelper.cs
Last active April 17, 2016 04:39
A quick Tag Helper for adding an external link icon to external links.
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Http;
namespace McPeak.TagHelpers {
[HtmlTargetElement("a", Attributes = "href")]
public class ExternalLinkTagHelper : TagHelper {
The following error occurs when typing the following command and hitting the enter key:
mstsc /v:machine_name
Faulting application name: SearchUI.exe, version: 10.0.10240.16515, time stamp: 0x55fa5578
Faulting module name: CortanaApi.dll, version: 0.0.0.0, time stamp: 0x55fa5354
Exception code: 0xc0000409
Fault offset: 0x000000000013e739
Faulting process id: 0x408
Faulting application start time: 0x01d11d52ee752e66

#Goodbye Windows Phone

In late 2010, I entered into the world of smart phones not by purchasing an iPhone, but buying into the Microsoft ecosystem with a Samsung Focus running Windows Phone 7. That probably doesn’t surprise you considering my background with Microsoft technologies and products; however, despite what many people think, I’m not a blind Microsoft follower.

I chose Windows Phone for primarily one reason: the UI. I love the Metro (yes, I still call it that) design, and I had since using a Zune. I owned a Zune, but it wasn’t my first portable MP3 player. I purchased a Zune because of the issues I had with my 2nd-gen iPod Nano. Unlike iPod, the Zune’s OS was stable, and I was pleasantly surprised by the superior sound quality. So when it came time to purchase my first smart phone, I chose Microsoft based upon my personal experience. And I wasn’t disappointed.

That’s not to say that Windows Phone didn’t (and still doesn’t) have issues; it obviously has a lot. First and foremost is the app gap. Die

@jwmcpeak
jwmcpeak / BasicDynamicQuery.cs
Last active August 29, 2015 14:05
Extension method to asynchronously query a database and build a dynamic result set
public static async Task<IEnumerable<dynamic>> QueryAsync(this DbConnection db, string sql)
{
var records = new List<dynamic>();
using (var cmd = db.CreateCommand())
{
cmd.CommandText = sql;
using (var reader = await cmd.ExecuteReaderAsync())
{
@jwmcpeak
jwmcpeak / gist:6855443
Created October 6, 2013 15:33
WinJS.Namespace.define with Form elements work around.
// assuming element with submitID is an input or button element
// work around 1
WinJS.Namespace.define("ui", {
submit : null
});
ui.submit = document.getElementById("submitID");
// work around 2
@jwmcpeak
jwmcpeak / TypeScript Overload
Created December 8, 2012 01:32
TypeScript Overload with No Parameters
// constructor
class Foo {
constructor ();
constructor (parm: string);
constructor (obj?: any) {
// implementation
}
}
// function
@jwmcpeak
jwmcpeak / gist:3701666
Created September 11, 2012 20:12
JS Inheritence
var Person = function(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
};
Person.prototype.sayHi = function() {
return "Hello there!";
};
@jwmcpeak
jwmcpeak / XParser 2
Created November 10, 2011 20:25
XParser 2 -- A JavaScript RSS/Atom Parser (2006)
/***********************************
XParser: An Atom and RSS parser
Version 2.0
by Jeremy McPeak http://www.wdonline.com
Copyright(c) 2004-2006 Jeremy McPeak. All Rights Reserved.
Dependencies: zXml Library by Nicholas C. Zakas, http://www.nczonline.net/
***********************************/
var xparser = {};
@jwmcpeak
jwmcpeak / RazorExtensions.cs
Created March 28, 2011 16:26
A quick and easy repeater for Razor.
public static class RazorExtensions
{
// a quick and simple repeater helper method
// header and footer templates could be added
public static HelperResult Repeater<T>(
this IEnumerable<T> items,
Func<T, HelperResult> itemTemplate,
Func<T, HelperResult> alternatingItemTemplate = null,
Func<T, HelperResult> separatorTemplate = null)
@jwmcpeak
jwmcpeak / mouseMenuClass.js
Created October 19, 2010 19:02
Old menu system I wrote in 2001
/**********************************************************************************************************
XWeb Mouse Menu Class v2.4.5
Version 2 brings in several things. First is the removal of proprietary MS code and the implementation of standard code.
It now only works with MSIE 5.5+ and Mozilla 0.9.2+. The code has taken more of an object oriented approach and the introduction
of a menu handler (thanks to Erik @ WebFX for the idea). If anyone finds any bugs, feel free to email them to me. I've started to
lay down the ground work for v3, which will include support for unlimited submenus.
***Version history***
Version 1: Microsoft IE 4+ only.