Skip to content

Instantly share code, notes, and snippets.

View hasnhasan's full-sized avatar
🎯
Focusing

Hasan hasnhasan

🎯
Focusing
View GitHub Profile
use Illuminate\Support\Collection;
Collection::macro('reverseNested', function ($childrenField,$parents=[]) {
$result = collect();
foreach ($this->items as $item) {
if ($item->$childrenField) {
$parents[] = $item->name;
$subCategories = collect($item->$childrenField)->map(function($cat) use ($parents){
$cat->parents = $parents;
$this->info('--Aktarım Başladı-');
$connectionName = 'old_mysql';
$newDb = \DB::connection('');
$oldDb = \DB::connection($connectionName);
$tmpOldTables = $oldDb->getDoctrineSchemaManager()->listTables();
$tables = $newDb->getDoctrineSchemaManager()->listTables();
$newTables = [];
$foreignKeys = [];
$indexes = [];
$response = $next($request);
$buffer = $response->getContent();
ini_set('zlib.output_compression', 'On'); // If you like to enable GZip, too!
$buffer = preg_replace('~<img(?!.*data-lazyno)[^>]*\K(?=src)~i', 'data-r', $buffer);
$response->setContent($buffer);
$buffer = $response->getContent();
$buffer = preg_replace('~<iframe(?!.*data-lazyno)[^>]*\K(?=src)~i', 'data-r', $buffer);
$response->setContent($buffer);
sudo chgrp -R brew /usr/local/Cellar
sudo chgrp -R brew /usr/local/Homebrew
sudo chgrp -R brew /usr/local/var/homebrew
sudo chgrp -R brew ${HOME}/Library/Caches/Homebrew
sudo chgrp -R brew ${HOME}/Library/Logs/Homebrew
sudo chgrp -R brew /usr/local/etc
sudo chgrp -R brew /usr/local/opt
sudo chgrp -R brew /usr/local/bin
sudo chgrp -R brew /usr/local/var
sudo chgrp -R brew /usr/local/share/man/man1
server bakımı
1 kullanılmayan veri tabanlarını sil
2 error logları sil
3 yüksek mailleri sil
4 tüm resimleri sıkıştır
5 kullanılmayan dosyaları temizle
http://blogsearch.google.co.th/ping/RPC2
http://www.blogsearch.google.ru/ping/RPC2
http://www.blogsearch.google.co.ve/ping/RPC2
http://www.blogsearch.google.de/ping/RPC2
http://www.blogsearch.google.gr/ping/RPC2
http://www.blogpeople.net/ping
http://blogsearch.google.be/ping/RPC2
http://xping.pubsub.com/ping/
http://blogsearch.google.ae/ping/RPC2
http://blogsearch.google.at/ping/RPC2
$dl->debug(function ($type, $buffer) {
if (preg_match_all('/\[download\] (.*?)\% of (.*?)M/',$buffer,$match)) {
$perchant = (int)trim($match[1][0]);
if ($perchant > 0) {
echo $perchant . "<br>";
}
}
});
function isLocation($url,$returnBaseUrl= false){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT ,5);
curl_setopt($ch,CURLOPT_TIMEOUT, 15);
function remoteFileSize($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT ,5);
curl_setopt($ch,CURLOPT_TIMEOUT, 15);
function isImage($url = '') {
if (!strstr($url,'http')) return false;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);