Skip to content

Instantly share code, notes, and snippets.

View yemrekeskin's full-sized avatar
🎯
Focusing

yunus emre keskin yemrekeskin

🎯
Focusing
View GitHub Profile
namespace OMR.Core.Helpers
{
using System;
using System.Collections;
using System.Collections.Generic;
public class EventAggregator
{
public IDictionary<Type, IList> Subscribers;
@yemrekeskin
yemrekeskin / FixedSizedQueue.cs
Created September 3, 2014 18:19
FixedSizedQueue
namespace Sample
{
using System.Collections.Concurrent;
public class FixedSizedQueue<T>
{
ConcurrentQueue<T> q = new ConcurrentQueue<T>();
public int Limit { get; internal set; }
@yemrekeskin
yemrekeskin / dbo.SplitString.sql
Created September 2, 2014 11:29
t-sql split function
CREATE FUNCTION [dbo].[SplitString]
(
@string NVARCHAR(MAX),
@delimiter CHAR(1)
)
RETURNS @output TABLE(splitdata NVARCHAR(MAX)
)
BEGIN
DECLARE @start INT, @end INT
SELECT @start = 1, @end = CHARINDEX(@delimiter, @string)
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Sub", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "SubdomainController", action = "AnyActionYouLike", id = UrlParameter.Optional },
@yemrekeskin
yemrekeskin / GuidCombGenerator.cs
Created August 3, 2014 13:34
Sequential Guid Generator C#
public interface IIdentifierGenerator
{
Guid SequentialGuid();
}
public class GuidCombGenerator
: IIdentifierGenerator
{
public Guid SequentialGuid()
{
@yemrekeskin
yemrekeskin / DataProcessor.cs
Created July 31, 2014 08:49
template method design pattern's implementation - DataProcessor
public abstract class DataProcessor
{
public abstract void SetDataSource(string url);
public abstract bool IsValid();
public abstract void Parse();
public abstract void SaveData();
// template method
public void GetResult()
{
if (IsValid())
@yemrekeskin
yemrekeskin / SeoHelper.cs
Created July 31, 2014 08:01
Seo Helper Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
public static class SeoHelper
{
public static string[] GetKeywords(string input, bool cultureInvariant)
{
@yemrekeskin
yemrekeskin / Benchmark.Entity.Model.cs
Created July 31, 2014 07:56
Benchmark Entity Modelling
public class Benchmark
{
public static BenchmarkResult Run(Action action)
{
return Run(action, null, null);
}
public static BenchmarkResult Run(Action action, string name, string message)
{
var dateStarted = DateTime.Now;
@yemrekeskin
yemrekeskin / TurkishIdNoGenerator.cs
Created July 23, 2014 11:09
Random Turkish Identification Number Generator with c#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Samples
{
class Program
{
@yemrekeskin
yemrekeskin / TurkishIdNoGenerator.html
Created July 23, 2014 08:33
Random Turkish Identification Number Generator with javascript
<!--
Random Turkish Identification Number Generator
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>