Skip to content

Instantly share code, notes, and snippets.

Avatar
🍻
Cheers!

Ozan Kurt OzanKurt

🍻
Cheers!
View GitHub Profile
@OzanKurt
OzanKurt / arr_dot.js
Created Dec 8, 2020
Laravel's Arr::dot function for Javascript.
View arr_dot.js
/**
* Laravel's Arr::dot function for Javascript.
* IMPORTANT: Requires lodash installed.
*/
function dot(array, prepend) {
results = []
prepend = prepend || ''
$.each(array, function(key, value) {
if ((_.isObject(value) || _.isArray(value)) && ! _.isEmpty(value)) {
View Marge.php
<?php
namespace App\Merge;
class Marge
{
protected $data = [];
public function setData($data)
{
@OzanKurt
OzanKurt / maxBy.php
Created Aug 15, 2020 — forked from adamwathan/maxBy.php
maxBy/minBy macros
View maxBy.php
<?php
Collection::macro('maxBy', function ($callback) {
$callback = $this->valueRetriever($callback);
return $this->reduce(function ($result, $item) use ($callback) {
if ($result === null) {
return $item;
}
return $callback($item) > $callback($result) ? $item : $result;
View app.css
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */
/*
...
...
...other css
...
View Datatables Search on Enter.js
"initComplete": function () {
var api = this.api();
$('.dataTables_filter:first input').off('.DT').on('keyup.DT', function (e) {
if (e.keyCode == 13) {
api.search(this.value).draw();
}
});
},
@OzanKurt
OzanKurt / DatabaseNotificationCollection.php
Created Dec 9, 2016
Why don't we optimize database interactions?
View DatabaseNotificationCollection.php
<?php
namespace Illuminate\Notifications;
use Illuminate\Database\Eloquent\Collection;
class DatabaseNotificationCollection extends Collection
{
/**
* Mark all notification as read.