Skip to content

Instantly share code, notes, and snippets.

View semiherdogan's full-sized avatar

Semih ERDOGAN semiherdogan

View GitHub Profile
@semiherdogan
semiherdogan / datatables.default.config.js
Created September 4, 2018 08:48
Datatables default config (Turkish)
$.extend( true, $.fn.dataTable.defaults, {
processing: true,
serverSide: true,
ajax: {
url: '',
type: 'POST'
},
aLengthMenu: [[15, 25, 50, 75, -1], [15, 25, 50, 75, 'Tümü']],
iDisplayLength: 15,
lengthChange: true,
@semiherdogan
semiherdogan / ajaxloader.js
Last active January 17, 2019 11:01
Ajax Loader JS
// TODO: find js way
$.ajaxSetup({
beforeSend: function (xhr) {
ajaxLoader.show();
},
complete: function (xhr,status) {
ajaxLoader.hide();
}
});
@semiherdogan
semiherdogan / boop_random_string.js
Last active July 21, 2020 09:06
Boop random string generator
/**
{
"api":1,
"name":"Random String",
"description":"Generates random string",
"author":"Semih",
"icon":"quote",
"tags":"random, string"
}
**/
@semiherdogan
semiherdogan / attempt.md
Last active January 30, 2023 13:07
Php attempt function

Php Attempt Function

Usage

[$result, $exception] = attempt(function() {
    throw new \Exception('hello exception');
});

if ($exception){
 // Do something with exception
@semiherdogan
semiherdogan / LogResponseTimeMiddleware.php
Created November 14, 2023 13:04
Laravel log response time middleware
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\Response;
class LogResponseTimeMiddleware
{