Skip to content

Instantly share code, notes, and snippets.

:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

Block or report user

Report or block tugberkugurlu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View PaymentActions.sql
/****** Object: Table [dbo].[PaymentActions] Script Date: 10/14/2011 11:53:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PaymentActions](
[PaymentActionID] [uniqueidentifier] NOT NULL,
[PaymentID] [uniqueidentifier] NOT NULL,
View web.config
<system.webServer>
<rewrite>
<rules>
<rule name="lowerCaseForce" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
</rules>
</rewrite>
</system.webServer>
View gist:1993661
[TestMethod]
public void ConnegTest()
{
var selector = new FormatterSelector();
var response = new HttpResponseMessage();
response.RequestMessage = new HttpRequestMessage();
var headers = response.RequestMessage.Headers;
headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain"));
headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json",0.8));
@tugberkugurlu
tugberkugurlu / gist:2027936
Created Mar 13, 2012 — forked from darrelmiller/gist:2026145
ThroughputMessageHandler
View gist:2027936
public class ThroughputMessageHandler : DelegatingHandler
{
private readonly ILogger _logger;
private Timer _timer;
private int _count;
public ThroughputMessageHandler(ILogger logger)
{
_logger = logger;
_count = 0;
_timer = new Timer(new TimerCallback(timerCallback),null,1000,1000);
@tugberkugurlu
tugberkugurlu / gist:2040145
Created Mar 14, 2012 — forked from darkiri/gist:2039990
is there a method which returns all .net base types/structs that System.Convert is able to convert to/from?
View gist:2040145
typeof (Convert)
.GetMethods(BindingFlags.Static|BindingFlags.Public)
.Where(m=>m.Name.StartsWith("To"))
.Select(m=>m.GetParameters().First().ParameterType)
.Distinct()
View lotsofjs.txt
paul@jupiter:~/GitHub/SignalR% wc -l **/*.cs | grep 'total'
13141 total
paul@jupiter:~/GitHub/SignalR% wc -l **/*.js | grep 'total'
94225 total
View CustomFilterProvider.cs
public class CustomFilterProvider : IFilterProvider {
public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) {
yield return new Filter(
new SecondaryLoggingFilterAttribute(), FilterScope.Controller, null
);
}
}
View AsyncResult.cs
// From http://msdn.microsoft.com/en-us/magazine/cc163467.aspx
internal class AsyncResult : IAsyncResult
{
// Fields set at construction which never change while
// operation is pending
readonly AsyncCallback m_AsyncCallback;
readonly Object m_AsyncState;
// Fields set at construction which do change after
// operation completes
@tugberkugurlu
tugberkugurlu / ValidateModelStateAttribute.cs
Created May 25, 2012
ValidateModelStateAttribute Action Filter
View ValidateModelStateAttribute.cs
public class ValidateModelStateAttribute : ActionFilterAttribute {
public override void OnActionExecuting(HttpActionContext actionContext) {
var modelState = actionContext.ModelState;
if (!modelState.IsValid) {
var errors = modelState.Keys
.Where(key => modelState[key].Errors.Any())
View AuthController.md

Controller

public class AuthController : ApiController {

    public HttpResponseMessage Post(string email, string userName, string password) {

        return new HttpResponseMessage(HttpStatusCode.OK);
    }
}
You can’t perform that action at this time.