Skip to content

Instantly share code, notes, and snippets.

Enjoy coding ❤️

Veaceslav Medvedev slavcodev

View GitHub Profile
slavcodev / 666_lines_of_XSS_vectors.html
Created Mar 20, 2019 — forked from JohannesHoppe/666_lines_of_XSS_vectors.html
666 lines of XSS vectors, suitable for attacking an API copied from
View 666_lines_of_XSS_vectors.html
<img src=1 href=1 onerror="javascript:alert(1)"></img>
slavcodev /
Created Dec 24, 2018 — forked from codeinthehole/
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
# Bootstrap script for setting up a new OSX machine
# This should be idempotent so it can be run multiple times.
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
# - Twitter (app store)
slavcodev / composer.json
Last active Feb 28, 2018
Composer useful scripts
View composer.json
"scripts": {
"test": "phpunit",
"test-coverage": "phpunit --coverage-clover build/logs/clover.xml",
"show-coverage": "phpunit --coverage-text=php://stdout",
"report-coverage": "phpunit --coverage-html build/logs/report",
"diff-files": "f() { git diff --name-only --diff-filter=ACMRTUXB $1 | grep -ivE composer\\.\\|\\.git ; }; f",
"cs": "f() { if test \"$1\"; then php-cs-fixer fix --dry-run --config=.php_cs -v --using-cache=no --diff --diff-format=udiff --ansi $1 ; else echo \"Nothing to fix\" ; fi ; }; f",
"cs-fix": "f() { if test \"$1\"; then php-cs-fixer fix --config=.php_cs -v --using-cache=no --diff --diff-format=udiff --ansi $1 ; else echo \"Nothing to fix\" ; fi ; }; f",
slavcodev /
Created Apr 4, 2017 — forked from nikic/
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

slavcodev / .profile
Created Feb 2, 2017 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
View .profile
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info

Инверсия управления (англ. Inversion of Control, IoC) — важный принцип объектно-ориентированного программирования, используемый для уменьшения зацепления в компьютерных программах. Также архитектурное решение интеграции, упрощающее расширение возможностей системы, при котором контроль над потоком управления программы остаётся за каркасом -

Сегодня хотелось бы поговорить о реализации инверсии управления в Laravel. Это один из самых важных аспектов организации слабой связанности компонентов в любимом нами фреймворке, и его понимание играет ключевую роль при создании качественных пакетов и приложений.

Когда мы говорим об IoC в Laravel, то следует знать, что он стоит на трех китах:

  1. Внедрение зависимостей (Dependency Injection)
slavcodev /
Created Apr 7, 2016 — forked from loonies/
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6


Check those constraints:

slavcodev /
Created Feb 16, 2016 — forked from hofmannsven/
My simply Git Cheatsheet
slavcodev / UUID.php
Last active Aug 29, 2015 — forked from dahnielson/UUID.php
Pure PHP UUID generator
View UUID.php
* UUID class
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.



  • Perfect for complex "client-side" application, where the complexity is more in the way "components" of an app interacts with each other than in the way they sync and or interact with a backend.
  • Very clean separation of concerns
  • Uses concepts that kind of look likes the future of HTML/DOM (DOM templates, binding attributes…).


  • A bit complicated to grasp. A lot of new concepts.
You can’t perform that action at this time.