Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Hasan hasnhasan

🎯
Focusing
View GitHub Profile
View gist:f4da71323b35d4bef5a21158200560c9
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;
View inventory VMware
# Get VM Host Collector Settings
# Host Serial Number Fix
# Check Serial Number
# Hardware Operational Status Function
# Hardware Health State Function
# Hardware Status Description Function
# Datastore Mount Information
# Hardware Information
# Get VM Host Modules
# Get Processor Information
View db diff
$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 = [];
View img change middleware
$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);
View Permission
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
View Sunucu Bakımı
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
View RSS Services
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
View gist:020dfea6683dfa0d4e5c42f26d2037e8
$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>";
}
}
});
View is location
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);
View Remote file size
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);