Skip to content

Instantly share code, notes, and snippets.

Avatar
🍻
Cheers!

Ozan Kurt OzanKurt

🍻
Cheers!
View GitHub Profile
@OzanKurt
OzanKurt / localStorage.async.js
Created January 13, 2023 01:56 — forked from JustSteveKing/localStorage.async.js
Using JavaScript Promises to stop render blocking with localStorage
View localStorage.async.js
class Storage {
get(item) {
const request = new Promise((resolve, reject) => {
let data = localStorage.getItem(item);
console.log(`Start of promise`);
(data) ? resolve(data) : reject();
});
request.then((data) => {
console.log(`promise resolved`);
@OzanKurt
OzanKurt / localStorage.size.js
Created January 13, 2023 01:56 — forked from JustSteveKing/localStorage.size.js
A little script to check the size of your localStorage - for management purposes
View localStorage.size.js
let total = 0, amount, item;
for (item in localStorage) {
amount = ((localStorage[item].length + item.length) * 2);
total += amount;
}
console.log(`Total = ${(total / 1024).toFixed(2)}KB`);
@OzanKurt
OzanKurt / event.js
Created January 13, 2023 01:56 — forked from JustSteveKing/event.js
Custom Event Handler
View event.js
class Event {
constructor() {
this.events = {};
}
fire(event, data) {
const Event = this.events[event];
if( Event ) {
Event.forEach(callback => {
callback.call(null, data);
@OzanKurt
OzanKurt / pint.json
Created January 13, 2023 01:54 — forked from JustSteveKing/pint.json
Laravel Pint configuration
View pint.json
{
"preset": "psr12",
"rules": {
"align_multiline_comment": true,
"array_indentation": true,
"array_syntax": true,
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
@OzanKurt
OzanKurt / cleanup.js
Last active April 17, 2022 05:39
Clean Up your YouTube
View cleanup.js
// Delete All Comments
// 1- https://myactivity.google.com/page?page=youtube_comments
// 2- Run the script
let delay = ms => new Promise(res => setTimeout(res, ms));
let btns = document.querySelectorAll('.VfPpkd-Bz112c-LgbsSe.yHy1rc.eT1oJ')
for (let i = 0; i < btns.length; i++) {
console.log(i)
let btn = btns[i]
await delay(500)
@OzanKurt
OzanKurt / Sublime Text 3.2.2 Build 3211 key licence
Created December 22, 2021 08:24 — forked from OrionUnix/Sublime Text 3.2.2 Build 3211 key licence
Sublime Text 3.2.2 Build 3211 key licence
View Sublime Text 3.2.2 Build 3211 key licence
----- BEGIN LICENSE -----
Member J2TeaM
Single User License
EA7E-1011316
D7DA350E 1B8B0760 972F8B60 F3E64036
B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
FA0A2ABE 25F65BD8 D51458E5 3923CE80
87428428 79079A01 AA69F319 A1AF29A4
A684C2DC 0B1583D4 19CBD290 217618CD
@OzanKurt
OzanKurt / arr_dot.js
Created December 8, 2020 00:51
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 August 15, 2020 03:30 — 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;
@OzanKurt
OzanKurt / app.css
Created August 15, 2020 03:29 — forked from adamwathan/app.css
View app.css
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */
/*
...
...
...other css
...