Skip to content

Instantly share code, notes, and snippets.

View relliv's full-sized avatar
no time for caution

Eyüp Erdoğan relliv

no time for caution
View GitHub Profile
@relliv
relliv / ProductController.php
Created January 4, 2023 09:04
Reorder between two records
<?php
...
public function switchRows(UpdateProductRowsRequest $request): JsonResponse
{
$input = $request->validated();
$sourceItem = $this->baseRepository->find($input['sourceId']);
@relliv
relliv / class-naming-convention.md
Created November 29, 2022 11:27 — forked from whizark/class-naming-convention.md
HTML/CSS Class Naming Convention #html #css #sass
@relliv
relliv / webpack-light-mode.js
Last active October 21, 2022 08:01
Webpack light mode script for tampermonkey
// ==UserScript==
// @name Webpack Error Screen Light Mode
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author EgoistDeveloper
// @match http://localhost:4200/*
// @icon https://cdn-icons-png.flaticon.com/512/7979/7979660.png
// @grant none
// ==/UserScript==
@relliv
relliv / trim-white-space.php
Created August 25, 2022 13:38
Trim white space in image with intervention
<?php
// https://image.intervention.io/v2/api/trim
use Intervention\Image\ImageManager as Image;
$imagePath = storage_path('app\public\product\images\testa.jpg');
$newPath = public_path('testa.jpg');
$image = new Image();
$res = $image->make($imagePath)->trim('top-left', null, 50, 30)->save($newPath);
@relliv
relliv / natsort-images.php
Created August 24, 2022 17:37
List images with pure PHP and natsort
$models3dPath = __DIR__ . '/./img/3d-models';
$models3dList = null;
if (!file_exists($models3dPath)) {
mkdir($models3dPath, 0775, true);
}
if (file_exists($models3dPath)) {
$files = scandir($models3dPath);
$files = array_diff($files, array('.', '..'));
@relliv
relliv / StorageTrait.php
Created August 5, 2022 08:46
Laravel file upload/storage trait
<?php
namespace App\Traits;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;
trait StorageTrait
{
/**
@relliv
relliv / comment-clear.regex
Last active August 1, 2022 11:29
Clear comment tags regex in HTML
// clear comment tags regex
([ \n]+.|\n)?<!--[ ]+(.*)-->
// https://regex101.com/r/W6GLaQ/1
@relliv
relliv / unicode.controller.ts
Last active July 11, 2022 20:13
Check given emoji is supporting by headless chromium
/* eslint-disable no-var */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { HttpService } from '@nestjs/axios';
import { Controller, Get, Param } from '@nestjs/common';
import { HTMLElement, Node, NodeType, parse } from 'node-html-parser';
import { catchError, map, Observable, of } from 'rxjs';
import puppeteer from 'puppeteer';
@Controller('unicode')
export class UnicodeController {
@relliv
relliv / laravel.txt
Created May 29, 2022 14:31
Laravel & Package Folder Structure
src
├─> app
│ ├─> Console
│ │ └── Kernel.php
│ ├─> Exceptions
│ │ └── Handler.php
│ ├─> Http
│ │ ├─> Controllers
│ │ │ └── Controller.php
│ │ ├── Kernel.php
@relliv
relliv / cookies.js
Last active May 28, 2022 18:01 — forked from InfamousStarFox/cookies.js
JavaScript cookie helper
/**
* Cookie utility
*
* @source https://gist.github.com/InfamousStarFox/cd246a19dcc3fec3d4e84176bb803e6d
*/
var cookie = {
get: function (cookieName) {
var cookie = document.cookie.split(";").find(function (item) {
return item.trim().startsWith(cookieName + '=');
});