Skip to content

Instantly share code, notes, and snippets.

View fatagun's full-sized avatar
🏐
Focusing

firat fatagun

🏐
Focusing
View GitHub Profile
public static class IEnumerableExtensions
{
public static DataTable AsDataTable<T>(this IEnumerable<T> data)
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T));
var table = new DataTable();
foreach (PropertyDescriptor prop in properties)
table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType);
foreach (T item in data)
{
interface IMessageProcessor
{
public string Process(string message);
}
Item[] GetItems();
IFoo Map(Bar bar);
interface CustomerService
{
// Queries
Customer GetCustomer(int id);
IEnumerable<Customer> GetPreferredCustomers();
// Commands
void CreateCustomer(Customer customer);
void EditCustomer(CustomerDetails customerDetails);
public class UrlGenerator
{
private static readonly char[] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".ToCharArray();
public static string ConvertToUrl(int number)
{
try
{
string shortenedUrl = string.Empty;
@fatagun
fatagun / CacheWrapper.cs
Created September 28, 2017 16:35
CacheWrapper
public interface ICache<T> where T : class
{
void Put(object key, T value);
T Get(object key);
void Update(object key, T value);
}
public abstract class CacheBase<T> : ICache<T> where T : class
{
@fatagun
fatagun / gist:b1ed6ebd0a3df46a793aaf588871b7be
Created October 1, 2018 16:52 — forked from ehuynh/gist:2572398
Start and Stop Jenkins on OSX
# start
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
# stop
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
var controllers = from type in myAssembly.GetTypes()
where type.Name.Contains("Controller")
where !type.IsAbstract
select type;
// bunun yerine ITypeLocator kullanabilirsin.
// _locator.FindClassesOfType<Controller>();
foreach(var controller in controllers)
{
public class Order
{
public int Id { set; get; }
public string Customer { set; get; }
public PaymentDetails PaymentDetails { set; get; }
public List<LineItem> LineItems { set; get; }
}
public class PaymentDetails
{
@fatagun
fatagun / product-spec-template.md
Last active February 18, 2022 14:47 — forked from omgitstom/product-spec-template.md
Product Spec Template

Feature / Product Title

Overview

Why are we building this?

Goals

What do you want to achieve with building this? You can even talk about how this will effect Metrics or KPIs