Skip to content

Instantly share code, notes, and snippets.

View Fed0t's full-sized avatar

Fedot Serghei Fed0t

View GitHub Profile
@Fed0t
Fed0t / CheckNudeImageJob.php
Created November 21, 2018 11:05
nude detector laravel job deepai api guzzle
<?php
namespace App\Jobs;
use App\File;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use GuzzleHttp\Client;
@Fed0t
Fed0t / GoogleInAppBillingController.php
Created November 21, 2018 11:16
GoogleInAppBillingController php example
<?php
namespace App\Http\Controllers;
use App\AdminActivityLog;
use App\Exceptions\ValidationException;
use App\GooglePayment;
use App\GooglePaymentRenew;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Config;
@Fed0t
Fed0t / MailController.php
Last active November 21, 2018 11:55
SMTP send emails with PHPMailer over TLS
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
class MailController {
private $mailer;
public function __construct($body,$subject)
{
$this->mailer = new PHPMailer(true);
@Fed0t
Fed0t / WordsScanner.php
Created November 21, 2018 14:17
Simple words scanner class in PHP
<?php
$needleWords = 'work,hard,learn';
$text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ,work, nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in hard, culpa qui officia deserunt mollit anim id est laborum.';
$scanner = new WordsScanner($needleWords,$text);
$scanner->scanText();
class WordsScanner {
@Fed0t
Fed0t / NPerGroup.php
Created September 19, 2019 13:06 — forked from jsphpl/NPerGroup.php
laravel-pgsql-n-related-models-per-parent-with-scopes
<?php
namespace App\Models\Traits;
use DB;
/**
* This trait is to work around a problem where a limit on an Eloquent
* relation by default applies to all queried models in total.
*
@Fed0t
Fed0t / vhostsbot
Last active October 15, 2019 15:45
Create virtualhosts (.test) fast in WSL with apache2
#!/usr/bin/env python3
import os
import sys
euid = os.geteuid()
if euid != 0:
print("You need to be the Superuser to make changes to these files!")
args = ['sudo', sys.executable] + sys.argv + [os.environ]
os.execlpe('sudo', *args)
@Fed0t
Fed0t / Axios interceptor refreshToken - redux subscribe
Last active July 7, 2020 07:43
jsx reactjs axios redux refreshToken interceptor
import { saveRefreshToken } from 'containers/App/actions';
const config = require(`config/config`).default;
const axios = require('axios');
let isAlreadyFetchingAccessToken = false;
let subscribers = [];
export default function setupAxiosRefreshTokenInterceptor(axiosInstance, store) {
let accessToken = store.getState().global.userData.access_token;
let refreshToken = store.getState().global.userData.refresh_token;
@Fed0t
Fed0t / init.vim
Last active August 10, 2023 18:14
syntax on
filetype plugin indent on
set encoding=UTF-8
set number
set incsearch
set cursorline
set ignorecase
set smartcase
set nohlsearch
set -g default-terminal "screen-256color"
source "/usr/share/powerline/bindings/tmux/powerline.conf"
set -g history-limit 10000
unbind C-b
set -g prefix C-a
set -g mouse on
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
syntax on
filetype plugin indent on
set encoding=UTF-8
set number
set cmdheight=1
set ruler
set incsearch
set cursorline
set ignorecase