Skip to content

Instantly share code, notes, and snippets.

@4E71
4E71 / LoC.ps1
Created November 13, 2013 18:08
Count lines of code
# Add/Remove types as needed
ls * -recurse -include *.aspx, *.ascx, *.cs, *.ps1, *js | Get-Content | Measure-Object -Line
@4E71
4E71 / DbEntityValidationException.cs
Created July 11, 2013 21:50
Demonstrate unwrapping exception to provide useful troubleshooting message
public void SaveChanges()
{
try
{
_context.ChangeTracker.DetectChanges();
_context.SaveChanges();
}
catch (DbEntityValidationException ex)
{
// Retrieve the error messages as a list of strings.
@4E71
4E71 / _windows8_apps_reference.txt
Last active October 12, 2015 18:38
win8: notes
// Plan
//--------------------------------------
// Planning Windows Store apps
http://msdn.microsoft.com/en-us/library/windows/apps/hh465427
// Design inspiration
http://msdn.microsoft.com/en-us/library/windows/apps/hh868274.aspx
// Build
//--------------------------------------
@4E71
4E71 / convert_vdi_to_vhd.txt
Created November 6, 2012 21:03
virtual box: convert vdi to vhd
// Change the UID
>vboxmanage internalcommands sethduuid <NAME_OF_VDI>.vdi
// Clone and change format
>vboxmanage clonehd <NAME_OF_VDI>.vdi --format VHD
// Notes: vboxmanage is located in default installation directory of Virtual Box. If .vdi is currently in use, may
// have to shutdown and remove from the player.
@4E71
4E71 / RefactorNestedConditionals.cs
Created October 15, 2012 18:45
c#: refactoring nested conditionals example
using System;
namespace Program
{
class Program
{
/// <summary>
/// Show way to reduce cyclomatic complexity in nested conditionals.
/// </summary>
/// <param name="args"></param>
@4E71
4E71 / d3_resources.txt
Created September 26, 2012 23:32
d3.js: resources
Gallery
https://github.com/mbostock/d3/wiki/Gallery
A basic SVG line chart in ASP.Net MVC using d3.js:
http://www.orbifold.net/default/d3linechart/
@4E71
4E71 / consoleapp.cs
Created September 24, 2012 22:19
vs 2012 express: gotchas!
//Issue: Visual Studio Express 2012 for Web does not come with a console project template.
// Resolution: Create class library project, set project "Output type" to console application, and create a file with
// the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassLibrary1
{
@4E71
4E71 / win8config.txt
Created September 22, 2012 01:41
windows 8: configuration
// Enable remote desktop
Control Panel > All Control Panel Items > System > Advanced system settings
Navigate to Remote tab and configure settings.
// Allow machine to response to ping requests
Navigate to "Windows Firewall with Advanced Security" and enable the inbound rules for "File and Print Sharing (Echo Request - ICMPv4-In)".
@4E71
4E71 / devarch.txt
Created September 21, 2012 03:35
microsoft: dev arch and setup
// Development Architecture, Microsoft Web Development:
// Web development environment, WebMatrix 2
http://www.microsoft.com/web/webmatrix/next/
// Cloud source control, Team Foundation Server
https://[ACCT_NAME.]tfspreview.com/
// Source explorer, Team Explorer for Microsoft Visual Studio 2012
http://www.microsoft.com/en-us/download/details.aspx?id=30656
@4E71
4E71 / concurrent.go
Created September 17, 2012 19:11
GoLang: Concurrency example
// Concurrent.go
// Simple example that demonstrates usage of Go routines.
package main
import (
"fmt"
"time"
"math/rand"
)