Skip to content

Instantly share code, notes, and snippets.

View detroitpro's full-sized avatar
☠️

Eric Polerecky detroitpro

☠️
View GitHub Profile
@detroitpro
detroitpro / MOAR_POWER.cs
Created February 20, 2012 20:02
MOAR_POWER
[Test]
public void MOAR_POWER()
{
var mongoRepository = new MongoRepository<User>();
//FindAllAs is a method from the offical driver.
//http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial
mongoRepository.Collection.FindAllAs<User>();
}
@detroitpro
detroitpro / Developer-Questions.textile
Last active March 16, 2017 10:42
.NET Developer-Questions

You

  • Your twitter name:
  • Your blog address:
  • Your stackoverflow name:
  • Your github name:

Think of

The following is a list of nouns (person,place,thing). Please write down your first thoughts on each one. There is no right answer and it is assume you will not know all of them.

@detroitpro
detroitpro / gist:1323568
Created October 28, 2011 21:08
Sample Action
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
namespace Application
{
public class Sample : Controller
@detroitpro
detroitpro / gist:1169844
Created August 25, 2011 02:37
FileUploadHTML5
$(document).ready(function () {
if (window.File && window.FileReader && window.FileList && window.Blob) {
//console.log('2012');
wireUpModernFeatures();
} else {
//console.log('FAIL');
wireUpClassicFeatures();
}
});
@detroitpro
detroitpro / gist:1159398
Created August 20, 2011 17:45
Image Resize Service
using System;
using System.Drawing;
using System.IO;
using Uploaded.Core.Extensions;
using Uploaded.Core.Interfaces;
using Uploaded.Core.Model;
namespace Uploaded.Core.Services
{
public class ImageResizerService : IImageResizerService
@detroitpro
detroitpro / gist:1122792
Created August 3, 2011 14:42
Detecting HTML5 File Features
$(document).ready(function () {
if (window.File && window.FileReader && window.FileList && window.Blob) {
//console.log('2012');
wireUpModernFeatures();
} else {
//console.log('FAIL');
wireUpClassicFeatures();
}
});
@detroitpro
detroitpro / gist:1122742
Created August 3, 2011 14:18
Impersonation Usage
var credentials = new UserCredentials("domain", "username", "password");
using (var user = new UserImpersonation(credentials))
{
///my code here.
}
@detroitpro
detroitpro / UserImpersonation.cs
Created August 1, 2011 15:47
.NET User Impersonation
namespace Core.Impersonation
{
public class UserCredentials
{
private readonly string _domain;
private readonly string _password;
private readonly string _username;
public UserCredentials(string domain, string username, string password)
{
@detroitpro
detroitpro / FlashHelpers
Created December 16, 2010 04:44
Rob Conery's ASP.NET MVC FlashHelpers class - ala: rails
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
namespace System.Web.Mvc {
public static class FlashHelpers {
public static void FlashInfo(this Controller controller,string message) {
[ApiValidationAttribute21]
public bool Authenticate(ExternalDataContractRequestBase request)
{
return true;
}