Skip to content

Instantly share code, notes, and snippets.

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

Eyüp relliv

no time for caution
View GitHub Profile
@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 + '=');
});
@relliv
relliv / lv-installer.sh
Last active July 14, 2022 19:11
Laravel Installer Shell Script
#!/bin/sh
# false condititon on if statement
# sudo apt-get purge --auto-remove php
# Colorize given text
colorize() {
local defaultcolor='\033[0m'
local textColor='\033[0m'
@relliv
relliv / app-module-1.ts
Last active May 5, 2022 17:06
Nest + GraphQL - 1
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
@Module({
imports: [
GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver, // <-- this is the driver we want to use
debug: true, // enable graphql debug
playground: true, // enable graphql playground
@relliv
relliv / Localize.php
Created January 27, 2022 16:02
Laravel Carbon localize middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\Request;
use Carbon\Carbon;
@relliv
relliv / readme.md
Last active January 5, 2022 17:07
Search file or files in folder with PHP

"/([0-9]+)-([0-9]+)(.*)\.wav/" the regex pattern depends to your case and $matches[1] == $needle part in if block should be change to instead given pattern.

@relliv
relliv / .gitignore
Last active December 17, 2021 22:33
Build multiple apps' sass templates with webpack
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
@relliv
relliv / AppServiceProvide.php
Last active May 29, 2021 22:23
Laravel SVG loader directive example
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\File;
class AppServiceProvider extends ServiceProvider
{
@relliv
relliv / ReadableNumberHelper.php
Last active March 2, 2021 13:09 — forked from mauro-baptista/NumberFormat.php
Easily readable numbers with custom locale
<?php
namespace App\Helpers;
/**
* Numbers more readable for humans
* It intends to change numbers as 1000 as 1K or 1200000 as 1.2M
* This code is heavly base in this one: https://gist.github.com/RadGH/84edff0cc81e6326029c
* How to use \NumberFormat::readable(1000);
*
@relliv
relliv / chartjs-example.php
Last active December 21, 2020 01:42
PDO chart data example, chartjs multiline tooltip text
<script src="Chart.bundle.js"></script>
<?php
$host = 'localhost';
$username = 'root';
$password = '';
$db_name = 'tes';
$conn = new PDO("mysql:host={$host};dbname={$db_name}", $username, $password);
$conn->exec("set names utf8");
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);