Skip to content

Instantly share code, notes, and snippets.

View slavafomin's full-sized avatar
✌️
Let's make this World a better place!

Slava Fomin II slavafomin

✌️
Let's make this World a better place!
View GitHub Profile
@slavafomin
slavafomin / object-empty.js
Last active January 10, 2022 17:54
JavaScript is Object Empty Function
/**
* Returns true if specified object has no properties,
* false otherwise.
*
* @param {object} object
* @returns {boolean}
*/
function isObjectEmpty(object)
{
if ('object' !== typeof object) {
CREATE USER 'blog'@'localhost' IDENTIFIED BY 'password';
# SHOW CHARACTER SET;
CREATE DATABASE blog CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON blog.* TO 'blog'@'localhost';
FLUSH PRIVILEGES;
@slavafomin
slavafomin / acl.md
Last active August 29, 2015 14:03
Useful commands for Ubuntu

ACL

Remove all ACL entries

setfacl -R -b

The list of extensions to exclude from web project when downloading

Images

  • svg
  • psd
  • ai
  • eps
  • gif
  • ico
@slavafomin
slavafomin / 0-success-list.json
Last active August 29, 2015 14:04
JSON server response example
{
"success": true,
"data": [
{
"id": 1,
"title": "Foo"
},
{
"id": 2,
"title": "Bar"
@slavafomin
slavafomin / ForcedLogoutListener.php
Last active September 4, 2022 17:59
Logging user out of Symfony 2 application using kernel event listener
<?php
namespace App\Security;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@slavafomin
slavafomin / 0-readme.md
Last active April 4, 2020 04:29
Loop promises in Angular.js / Run list of actions sequantually

The provided example will allow you to do sequential requests to the server in Angular.js.

It will iterate all the items and call server for each item, however, if one request will fail, all sequential requests will be aborted.

If you need to call all requests no matter what, just replace promise.then() with promise.finally().

Cheers!

@slavafomin
slavafomin / Gulp-JavaScript-Resolve-Dependencies.md
Last active February 11, 2016 15:12
Gulp JavaScript Resolve Dependencies

Gulp JavaScript Resolve Dependencies

This Gulp task will resolve JavaScript dependencies and build individual bundles.

Install pre-requisites:

npm i --save-dev gulp gulp-resolve-dependencies gulp-uglify gulp-if gulp-foreach

Specify dependencies in your files:

@slavafomin
slavafomin / 0-README.md
Last active January 19, 2016 11:24
Angular.js Directive for Vimeo Player