Skip to content

Instantly share code, notes, and snippets.

View detroitpro's full-sized avatar
☠️

Eric Polerecky detroitpro

☠️
View GitHub Profile
@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 / 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: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: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: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 / 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 / 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 / gist:2582766
Created May 3, 2012 03:14
node-bamboo-campfire-deps
C:\Projects> mkdir nodeboocamp
Directory: C:\Projects
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 5/2/2012 11:10 PM nodeboocamp
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class CvvAttribute : DataTypeAttribute
{
public CvvAttribute()
: base("cvv")
{
}
public override string FormatErrorMessage(string name)
{
@detroitpro
detroitpro / gist:8928899
Created February 11, 2014 03:40
ASP.NET Identity IUser*Store Implementations for ASP.NET MVC5 OWIN
Tugberk Ugurlu has an implementation for RavenDB: AspNet.Identity.RavenDB
https://github.com/tugberkugurlu/AspNet.Identity.RavenDB
Daniel Wertheim has an implementation for CouchDB / Cloudant
https://github.com/danielwertheim/mycouch.aspnet.identity
InspectorIT has an implementation for MongoDB: MongoDB.AspNet.Identity
https://github.com/InspectorIT/MongoDB.AspNet.Identity