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 () {
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); |
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 () {
Ç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.');
}
<?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 |
// 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 \ |
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 |