Skip to content

Instantly share code, notes, and snippets.

View Bujhm's full-sized avatar
🐢
I may be slow to respond.

Igor Bujhm

🐢
I may be slow to respond.
View GitHub Profile
@Bujhm
Bujhm / axios-401-response-interceptor.js
Created September 15, 2020 08:53 — forked from yajra/axios-401-response-interceptor.js
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
@Bujhm
Bujhm / tokens.md
Created September 9, 2020 19:56 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@Bujhm
Bujhm / Readme.md
Created August 20, 2020 20:28 — forked from kunicmarko20/Readme.md
Sonata Admin Custom Page

Sonata Admin Custom Page

This example will help you create custom Sonata Admin page and also explain how to make a statistics admin.

You can read more here

@Bujhm
Bujhm / docker-cleanup-resources.md
Created August 6, 2020 11:53 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Bujhm
Bujhm / ImageProvider.php
Created May 18, 2020 20:56 — forked from kunicmarko20/ImageProvider.php
Sonata Media SVG Provider
<?php
namespace YourBundle\Provider;
use Sonata\MediaBundle\Provider\FileProvider;
class ImageProvider extends FileProvider
{
}
@Bujhm
Bujhm / docker-compose.yml
Created March 2, 2020 15:24 — forked from brunosimioni/docker-compose.yml
Docker Compose to Prometheus, PushGateway and Grafana setup
version: '2.1'
networks:
monitor-net:
driver: bridge
volumes:
prometheus_data: {}
grafana_data: {}
@Bujhm
Bujhm / exceptions-tree.php
Created January 22, 2020 04:58 — forked from mlocati/exceptions-tree.php
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');
@Bujhm
Bujhm / runtime_measurement.js
Created April 19, 2018 12:13
runtime measurement of javascript code
//Замеряем время выполнения Javascript кода
var time = performance.now();
//некий код
time = performance.now() - time;
console.log('Время выполнения = ', time);
@Bujhm
Bujhm / organization.wsdl
Last active April 17, 2018 07:25 — forked from umidjons/organization.wsdl
SOAP server/client example in WSDL mode
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="Organization"
targetNamespace="urn:Organization"
xmlns:tns="urn:Organization"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
@Bujhm
Bujhm / http_response_code.php
Created April 10, 2018 15:34 — forked from inxilpro/http_response_code.php
Polyfill for PHP 5.4's http_response_code() function.
<?php
if (!function_exists('http_response_code')) {
function http_response_code($code = null)
{
static $defaultCode = 200;
if (null != $code) {
switch ($code) {
case 100: $text = 'Continue'; break; // RFC2616