Skip to content

Instantly share code, notes, and snippets.

View tugberkugurlu's full-sized avatar
:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

:shipit:
💥 shakalaka
View GitHub Profile
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
### Check me into the root of the repo
### as .gitattributes
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
@tugberkugurlu
tugberkugurlu / error.txt
Created May 31, 2012 08:36
Related to ASP.NET MVC 4 Beta
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Expected "}".
Source Error:
Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1
##################################################
#resources
##################################################
#http://blogs.msdn.com/b/kalleb/archive/2008/07/19/using-powershell-to-read-xml-files.aspx
#http://tfl09.blogspot.com/2007/11/formatting-with-powershell.html
#http://www.powershellpro.com/powershell-tutorial-introduction/powershell-tutorial-conditional-logic/
##################################################
#resources
##################################################
@tugberkugurlu
tugberkugurlu / bcdedit.ps1
Created June 2, 2012 13:32
bcdedit examples
##################################################
#resources
##################################################
#http://technet.microsoft.com/en-us/library/cc721886(v=ws.10).aspx
#http://technet.microsoft.com/en-us/library/cc709667(v=ws.10).aspx
##################################################
#resources
##################################################
####################################################################################
public class HomeController : Controller {
[AsyncTimeout(1000)]
[HandleError(ExceptionType = typeof(TimeoutException), View = "TimeoutError")]
public async Task<ActionResult> Foo(CancellationToken cancellationToken) {
using (HttpClient client = new HttpClient()) {
await client.GetStringAsync("http://localhost:2098/Home/Wait", cancellationToken);
}
@tugberkugurlu
tugberkugurlu / InvalidModelStateFilterAttribute.cs
Created June 3, 2012 07:57 — forked from bradwilson/InvalidModelStateFilterAttribute.cs
A filter for ASP.NET Web API to return 400 upon invalid model binding
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class InvalidModelStateFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
@tugberkugurlu
tugberkugurlu / DbGeographyTryOut.cs
Created June 4, 2012 19:51
System.Data.Spatial.DbGeography sample (Latitude and Longitude).
class Program {
public class Db {
public static Dictionary<string, DbGeography> Locations = new Dictionary<string, DbGeography>() {
//instert the place locations here...
};
}
public async Task<ActionResult> Foo() {
//some sync stuff
//runs the async method
var foobar = await _someClass.GetAsync();
//this continuation ends up in another thread.
//cannot access some static instances such as HttpContext.Current
doSomeWork();