Skip to content

Instantly share code, notes, and snippets.

:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

:shipit:
💥 shakalaka
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 program.cs
class Program
{
static void Main(string[] args)
{
IEnumerable<string> basket1 = new List<string> { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
IEnumerable<string> basket2 = new List<string> { "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };
IEnumerable<string> basket3 = new List<string> { "21", "22", "23", "24", "25", "6", "7", "8", "9", "30" };
foreach (var item1 in basket1)
foreach (var item2 in basket2)
View program.cs
using System;
using System.IO;
using System.Net;
using System.Net.FtpClient;
using System.Threading.Tasks;
namespace FtpClientSample
{
class Program
{
@tugberkugurlu
tugberkugurlu / program.cs
Created Feb 10, 2014
Simple C# yield return sample
View program.cs
class Program
{
static void Main(string[] args)
{
IEnumerable<string> values = GetStrings().Take(10);
foreach (string value in values)
{
Console.WriteLine(value);
}
View program.cs
protected virtual string CreateMD5Hash(string input)
{
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("X2"));
View owin-di-question.md

I have an IFoo instance which I need to use as per request instance. Here is how my startup class look like:

public void Configuration(IAppBuilder app)
{
    HttpConfiguration config = new HttpConfiguration();
    config.Routes.MapHttpRoute("DefaultHttpRoute", "api/{controller}");

    app.Use<RandomTextMiddleware>()
       .UseWebApi(config);
}
@tugberkugurlu
tugberkugurlu / Program.cs
Created Feb 25, 2014
HttpClient usage sample
View Program.cs
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 100; i++)
{
Run();
}
using (HttpClient client = new HttpClient())
@tugberkugurlu
tugberkugurlu / program.cs
Last active Aug 29, 2015
How to Use Service Bus Queues
View program.cs
static void Main(string[] args)
{
// Reference: http://www.windowsazure.com/en-us/documentation/articles/service-bus-dotnet-how-to-use-queues/
// Service Bus Partitioned Queue: http://code.msdn.microsoft.com/windowsazure/Service-Bus-Partitioned-7dfd3f1f
// BrokeredMessage.ViaPartitionKey: http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.brokeredmessage.viapartitionkey.aspx
const string QueueName = "TestQueue";
string serviceBusConnStr = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
QueueDescription qd = new QueueDescription(QueueName);
@tugberkugurlu
tugberkugurlu / LinqExtensions.cs
Created Feb 27, 2014
Split IEnumerable<T> extension
View LinqExtensions.cs
public static class LinqExtensions
{
public static IEnumerable<IEnumerable<T>> Split<T>(this IEnumerable<T> list, int parts)
{
int i = 0;
var splits = from item in list
group item by i++ % parts into part
select part.AsEnumerable();
return splits;
}
@tugberkugurlu
tugberkugurlu / program.cs
Last active Aug 29, 2015
HttpClient TCP connection try
View program.cs
class Program
{
static void Main(string[] args)
{
ServicePointManager.DefaultConnectionLimit = 12;
for (int i = 0; i < 100; i++)
{
Run();
}
@tugberkugurlu
tugberkugurlu / Location.cs
Last active Aug 29, 2015
Location Class which should be struct?
View Location.cs
using System;
using System.Data.Spatial;
public class Location
{
public Location(double lat, double lng)
{
Latitude = lat;
Longitude = lng;
}
You can’t perform that action at this time.