Skip to content

Instantly share code, notes, and snippets.

View tufanbarisyildirim's full-sized avatar
🎯
Focusing

Tufan Barış Yıldırım tufanbarisyildirim

🎯
Focusing
View GitHub Profile
public string DataTableToWorkBook(DataTable dt, string postfix)
{
object oMissing = Missing.Value;
Microsoft.Office.Interop.Excel.Application app;
Microsoft.Office.Interop.Excel.Workbooks wkBks;
Microsoft.Office.Interop.Excel.Workbook wkBk;
Microsoft.Office.Interop.Excel.Sheets wkShts;
Microsoft.Office.Interop.Excel.Worksheet wkSht;
@tufanbarisyildirim
tufanbarisyildirim / sort_array_multidim.php
Created September 15, 2011 23:26
sort a multidimensional array by sql like order by clause
<?php
/**
* @name Mutlidimensional Array Sorter.
* @author Tufan Barış YILDIRIM
* @link http://www.tufanbarisyildirim.com
* @github http://github.com/tufanbarisyildirim
*
* This function can be used for sorting a multidimensional array by sql like order by clause
*
* @param mixed $array

Before Inlining

BenchmarkNextHash-16                    12962270                83.4 ns/op            20 B/op          2 allocs/op

After Inlining

BenchmarkNextHash-16                    32723619                33.9 ns/op             0 B/op          0 allocs/op
@tufanbarisyildirim
tufanbarisyildirim / hash.go
Last active April 29, 2020 13:37
zero allication fnv hashing of #golang
// https://github.com/golang/go/blob/master/src/hash/fnv/fnv.go#L100 the code we previously used
// has some allocations
// we need minimum footprint per deciding
func findIndex(s string, poolSize uint32) uint32 {
var h32a uint32 = 2166136261
for _, c := range []byte(s) {
h32a *= 16777619
h32a ^= uint32(c)
}
<?php
error_reporting(E_ALL);
$output = shell_exec('sudo svn up /srv/www/me.tufyta.com');
$lines = explode("\n",$output);
$colors = array(
'A' => array('#640064','Addding'),
'D' => array('#640000','Deleting'),
'U' => array('#3a32a0','Modified')
);
Verifying that +tfnyldrm is my blockchain ID. https://onename.com/tfnyldrm
@tufanbarisyildirim
tufanbarisyildirim / SqlClassGenerator.tt
Created November 20, 2013 14:02
Basic Model Class Generator
<#@ assembly name ="System.Data" #>
<#@ assembly name ="System.Xml" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Text" #>
<#+
class SQLClassGenerator
{
Dictionary<Type, string> _alias = new Dictionary<Type, string>();
@tufanbarisyildirim
tufanbarisyildirim / ServiceJsonAdapter.cs
Last active December 24, 2015 07:28
an http module example to publish .net asmx webservices as a restful service.
using System;
using System.Web;
using System.Reflection;
using System.Linq;
using System.Collections.Specialized;
using System.Collections.Generic;
namespace ServiceTest
{
public class ServiceJsonAdapter : IHttpHandler
@tufanbarisyildirim
tufanbarisyildirim / Kefukar.Dotnet.cs
Last active December 17, 2015 02:38
php DOTNET sınıfına bir örnerk
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kefukar
{
public class Dotnet
{
@tufanbarisyildirim
tufanbarisyildirim / GenericExtensions.cs
Last active December 16, 2015 10:49
select list items by using print page like string
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// TODO: check out of page ranges.
public static class GenericExtensions
{
public static List<T> PrintPagesFilter<T>(this List<T> list, string pattern)
{