Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

:shipit:
💥 shakalaka
View GitHub Profile
View MongoDB.ps1
configuration MongoDB {
param (
[string[]]$ComputerName = $env:ComputerName
)
node $ComputerName {
File SetupFolder {
Type = 'Directory'
DestinationPath = "C:\setup"
Ensure = 'Present'
}
View project . json
"dependencies": {
"Microsoft.Composition": "1.0.30" -- Is this nuget dependencies for all frameworks? (yes)
},
"frameworks": {
"dnx451": {
"dependencies": { -- Is this nuget just for dnx451? (yes)
"Blah"
},
"frameworkAssemblies": {
"System.Globalization": "", --This is GAC for dnx451? (yes)
@tugberkugurlu
tugberkugurlu / gist:1993661
Created March 7, 2012 15:01 — forked from darrelmiller/gist:1989131
Conneg with quality
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 March 13, 2012 09:58 — 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 March 14, 2012 22:43 — 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
@tugberkugurlu
tugberkugurlu / nginxproxy.md
Created October 2, 2015 12:13 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?
View nginxproxy.md

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@tugberkugurlu
tugberkugurlu / AsyncResult.cs
Created May 24, 2012 22:30 — forked from davidfowl/AsyncResult.cs
Before SignalR
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
View the original guy used autocrlf=false
### 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 / 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
View InvalidModelStateFilterAttribute.cs
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)