Skip to content

Instantly share code, notes, and snippets.

View eser's full-sized avatar
🎙️
Streaming on YouTube - https://eser.live

Eser Ozvataf eser

🎙️
Streaming on YouTube - https://eser.live
View GitHub Profile
@eser
eser / XamlUtils.cs
Last active December 14, 2015 14:08
Dynamic Xaml
using Sys = System;
using SysIO = System.IO;
using SysWinMarkup = System.Windows.Markup;
using SysXml = System.Xml;
using SysXmlLinq = System.Xml.Linq;
public static class XamlUtils {
public static object GetXamlObject(string source) {
SysXml.XmlDocument _xmlDocument = new SysXml.XmlDocument();
_xmlDocument.LoadXml(source);
// yapılacak her iş için çalışacak action delegate'ini tanımlayalım
Action action = new Action(delegate(object obj) {
// yapılacak iş objesi delegate'e parametre olarak geldi
Console.Write("{0}\t", obj);
});
// belirttiğimiz action delegate'ini her iş için maximum 5 thread halinde çalıştıracak Channel sınıfını oluşturalım
ChannelTaskQueue channel = new ChannelTaskQueue(5, action);
// kuyruğa dummy olarak 1000 adet iş objesi ekleyelim
Encoding _encoder = new GsmEncoding();
byte[] _data = _encoder.GetBytes(text);
@eser
eser / sf_delegates.md
Created April 15, 2013 15:20
Scabbia Framework: Delegates

Delegate sınıfı tetiklendiğinde kendisine kayıt ettirilmiş tüm metodları (fonksiyonları) sırasıyla çağıran bir yapıdır.

use Scabbia\Delegate;

$x = Delegate::assign();

$x(
 function () {
@eser
eser / sf_utils_phpversion.md
Created April 15, 2013 15:25
Scabbia Framework: Utils::phpVersion

Çalışmakta olan PHP sürümünün parametre olarak verilen sürümünü karşılaştırır.

use Scabbia\Utils;

if (!Utils::phpVersion('5.3')) {
    exit('This application requires PHP 5.3 or newer.');
}
@eser
eser / zeki_filtre.php
Created May 11, 2013 08:14
select filter
<?php
define('LEX_NONE', 0);
define('LEX_FIELD', 1);
define('LEX_COMMA', 2);
define('LEX_DOT', 3);
define('LEX_FUNC', 4);
define('LEX_PAR_OPEN', 5);
define('LEX_PAR_CLOSE', 6);
<?php
namespace x\Includes;
use Scabbia\Extensions\Helpers\String;
use Scabbia\Extensions\Models\Model;
/**
* Class xModel
* @package x
@eser
eser / manifest.md
Last active October 15, 2017 03:30 — forked from f/manifest.md

Topluluk Bildirgesi

  • Bu bildirge bir kural listesi değil, komünitemizin temel felsefesini tanımlayan bir metindir.
  • Komünite, kendisini bir topluluk olarak tanımlar.
  • Topluluğa dahil olmak, kişinin kendisini komüniteye dahil hissetmesiyle sağlanır, başka hiçbir kuralı yoktur.
  • Topluluk mevcut bir hiyerarşik düzene dahil veya sahip değildir.
  • Topluluğun tek amacı komünitenin ilgilendiği konuların çevresinde kişileri, hiçbir ayrım gözetmeksizin biraraya getirmektir.
  • Topluluğa dahil olan, kendisini dahil hisseden herkes; yasadışı, bir ismi lekeleyici veya rencide edici, etik olmayan bir harekete kalkışmadığı veya sebep olmadığı sürece kimseden izin almaksızın topluluk adına etkinlik, toplantı, bilgi paylaşımı, proje geliştirme başta olmak üzere her şeyi yapmakta özgürdür.
  • Topluluğun yönetimi veya bir sahibi yoktur. Yalnızca muhatapları vardır, muhataplar topluluğa dahil herhangi birisi olabilir, topluluğun genel kanaatine göre doğal yollarla edinilir, gönüllülük esasına dayanır.
  • İsteyen her
@eser
eser / fuatavni.js
Last active August 29, 2015 13:57 — forked from f/fuatavni.js
// Fuatavnizer v0.1
function fuatavni(s, t){var m=Math,y;y=[s.join("\n")+"\nAnaliz."].concat(t.split(/[\.\,]\s*/).filter(function(c){return!!c}).map(function(c,i){i++;var x=m.floor(m.random()*10)%3;return x==1?i+". Adetullahtandır, "+c+".":(x==2?i+". "+c+". Korkma, titre.":i+". "+c)}));y.push((y.length+1)+". Güzel insanlar, duanızı bekliyorum.");return y;}
// Usage:
fuatavni(["Lorem ipsum?", "dolor sit?"], "Lorem ipsum dolor sit amet, \
consectetur, sed do eiusmod tempor incididunt ut labore et dolore \
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation \
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute \
irure dolor in reprehenderit in voluptate velit esse cillum dolore \
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non \
@eser
eser / gist:e21ea1762b40a47675a0
Last active August 29, 2015 14:11
accessible www directory in debian
sudo gpasswd -a "$USER" www-data
sudo chown -R "$USER":www-data /var/www
find /var/www -type f -exec chmod 0660 {} \;
sudo find /var/www -type d -exec chmod 2770 {} \;
(even safer: use 640 or 2750 and manually chmod g+w file-or-dir that needs to be writable by the webserver)
// source: http://askubuntu.com/questions/46331/how-to-avoid-using-sudo-when-working-in-var-www