Skip to content

Instantly share code, notes, and snippets.

View Slauta's full-sized avatar
🎯
Focusing

Roman Slauta

🎯
Focusing
View GitHub Profile
$headers = [
'Content-Type' => 'application/json',
];
if ($accessToken) {
$header['X-Shopify-Access-Token'] = $accessToken;
}
if ($isGraphql) {
$header['Content-Type'] = 'application/graphql';
@Slauta
Slauta / index.php
Created September 16, 2021 08:44
FizzBuzz примеры использования на PHP
<?php
$start = 1;
$end = 100;
for ($number = $start; $number < $end + 1; $number++) {;
echo (implode('', array_map(function ($str, $delimeter) use ($number) {
return !($number % $delimeter) ? $str : '';
}, ['fizz', 'buzz'], [3, 5])) ?: $number) . "\n";
}
@Slauta
Slauta / README.md
Created June 9, 2021 10:58
Vue History Mode routing Nginx config example

HTML5 History Mode

The default mode for Vue Router is hash mode. It uses a URL hash to simulate a full URL so that the page won’t be reloaded when the URL changes.

We can set Vue Router to history mode to get rid of the hash. It uses history.pushState API to let us navigate URLs without a page reload.

This configuration allows you to configure nginx to work with Router History on the server side.

@Slauta
Slauta / query.sql
Created February 23, 2018 15:06
Enable slow query
SET GLOBAL log_output=file;
SET GLOBAL slow_query_log=ON;
SET GLOBAL long_query_time=0;
SET GLOBAL log_slow_rate_limit=100;
SET GLOBAL log_slow_rate_type=query;
SET GLOBAL log_slow_verbosity=full;
SET GLOBAL log_slow_admin_statements = ON;
SET GLOBAL log_slow_slave_statements = ON;
SET GLOBAL slow_query_log_always_write_time=1;
SET GLOBAL slow_query_log_use_global_control=all;
@Slauta
Slauta / .gitlab-ci
Last active March 18, 2024 16:53
electron-updater from private repo gitlab.com
variables:
VERSION_ID: '1.0.$CI_PIPELINE_ID'
stages:
- build
build:
image: slauta93/electron-builder-win
stage: build
artifacts:
@Slauta
Slauta / Wiredrap
Created July 21, 2017 15:03
Wiredrap min.js insert fixed
return gulp.src(BUILD_DIR+'/index.html')
.pipe(wiredep({
ignorePath: "../../"+APP_DIR,
bowerJson: require('./bower.json'),
exclude: [ /jquery/ ],
fileTypes: {
html: {
replace: {
js: function(filePath) {
var minFilePath = filePath.replace('.js', '.min.js');
@Slauta
Slauta / gist:7814272
Created December 5, 2013 21:31
Приведение телефонов Беларуси к единому международному формату
<?php
define('COUNTRY_CODE', '375');
define('COUNTRY_REPLACE_CODE', '80');
define('GRODNO_CODE', '152');
define('GRODNO_PHONE_LENGTH', 6);
$phone = array(
'414243' => '+375152414243',

В своем проекте я делал как-то так

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

@Slauta
Slauta / src\Acme\UserBundle\Entity\UserRepository.php
Created July 25, 2012 09:30
DataTable server side for Symfony 2 Doctrine (ver 2)
<?php
namespace Acme\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
/**
* UserRepository
*
@Slauta
Slauta / src\Acme\UserBundle\Entity\UserRepository.php
Created July 25, 2012 09:21
DataTable server side for Symfony 2 Doctrine
<?php
namespace Acme\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
/**
* UserRepository
*